5 ms·
I am using static-site-generator-webpack-plugin [0] on a client project now and it has been fantastic. I have one json file full of all the data of the site and
by asolove 11y ago
I am using static-site-generator-webpack-plugin [0] on a client project now and it has been fantastic. I have one json file full of all the data of the site and then a bunch of components that render it in various ways. I've got translations in several languages plus the components can use React-Intl to get text, dates, etc. in the right format for the locale.
The experience has been fantastic compared to other static site generators (very limited control over display of content) or CMSes (too indirect for what is basically simple logic, especially around internationalization).
It was a bit fiddly getting everything set up so that React, React Router, React Intl, and Static Site Generator all played nicely together. But after about a day of banging my head on that, it's just worked ever since and been a dream.
If I could ask for one improvement: right now the build first runs the code through Babel and then runs that through WebPack. Problem is, if parts of the Babel build fail, there's no error reporting, and instead I get a WebPack-stage error about some file not being available. I then have to manually run the file through Babel to see that there's a simple syntax error.
[0] https://github.com/markdalgleish/static-site-generator-webpack-plugin https://github.com/markdalgleish/static-site-generator-webpa...
- TN1ck 11y agoYou can use babel-eslint [0] and the eslint-loader [1] to catch all errors babel might have. [0] https://github.com/babel/babel-eslint https://github.com/babel/babel-eslint [1] https://github.com/MoOx/eslint-loader https://github.com/MoOx/eslint-loader
- asolove 11y agoAwesome, thanks!
- nkohari 11y agoI'm using pretty much the same setup, and the only trouble I have is that simple React exceptions can cause webpack-dev-server to terminate. It's not the end of the world, just kind of annoying to have to restart the dev server if I misspelled a variable! I'm not sure if this is the same problem you've encountered, but if you find a solution I'm definitely interested. :)
- danaw 11y agoCheckout the no errors plugin: https://github.com/webpack/docs/wiki/list-of-plugins https://github.com/webpack/docs/wiki/list-of-plugins
- jaquers 11y agoAre you using the babel-loader[0] for webpack? That generates nice errors right in the webpack prompt. [0] https://github.com/babel/babel-loader https://github.com/babel/babel-loader