A proof of concept of a "no frills" React with application using Webpack to generate a multi-page application (MPA), instead of the ordinary single-page application (SPA).
-
Every
FooBar.page.js
will become a static pagefoo-bar.html
, based offassets/template.html
. -
No server side rendering: each HTML page acts like an ordinary small React app.
-
No router: just standard HTML pages with standard
<a href=""></a>
links for navigation. -
The build can be served by any HTTP server, a Node.js server is not needed.
-
TypeScript support. Just rename
src
to something else and usesrc-TYPESCRIPT
assrc
instead. -
SASS support, with all style files parsed as CSS modules.
-
Run in development mode in
localhost:3000
:npm start
-
Generate a production build in
build
directory:- Configure
baseUrl
inproduction.config.json
to the final path in your web server npm run build
- Configure
I tried a couple different solutions for React MPA, and they all seemed huge and overengineered for such a simple idea. Also, they worked fine for simple projects, large projects led to headaches.
So I decided to write my own Webpack config with an opinionated file structure, and that's it. If you know Webpack, you can change the config to suit your needs.