Hacker News new | ask | show | jobs
by iiroj 2907 days ago
I wanted to submit my webpack plugin for adding "SSR" to an otherwise basic static website built with Webpack.

I'm a UX/UI designer but for the past two years have started coding JS/React as a way to improve my design and systems thinking. My own static website has been the playground for most of that time.

I've been through Gatsby and Next.js and wanted to make my own static boilerplate, but the SSR part was missing. I looked at the existing webpack plugins for generating HTML files but thought they mostly deal with templates.

html-renderer-webpack-plugin tries to do things a bit differently by providing an SSR-like interface where each defined path (supplied in webpack config) calls a PromiseLike function where you can do whatever based on the current path and the webpack stats object. The function then should return a string of HTML that gets saved into the output directory. Basically this allows one to port their Express application's SSR functionality into a static renderer.

As linked in the readme, a working example site can be found at https://github.com/iiroj/iiro.fi