-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack config refactor; CSS now generated with HTML #253
Conversation
Hi! nice refactor 👍. A few naming suggestions to run by you. What I've been thinking for renaming the stages to is An idea to explore in a future refactor (or current if you feel like trying it) would be to see if build times are sped up by spawning a separate process to build the Javascript and CSS/HTML (CSS needs to be built before HTML so it can be inlined). |
Because webpack will always generate a final javascript file, the 'build-css' stage isn't as clean as I'd like it.
Four stages. No use of the term 'SPA.' :0) I'm not fully happy with the change, however, because webpack doesn't seem to be able to just scan for CSS then produce one resultant CSS file. It will always generate a final bundle.js. So, like the 'build-html' step we have to delete a file afterwards. That extra bundle.js generation makes the build process quite a bit slower. Here's a full run on my blog with the four stages:
And here's a run on the previous commit, still three stages:
|
Hrrm... that is quite a bit slower. I'm really curious now if spawning separate processes would speed things up now. Parallelizing things seems like the only way to eke out more speed. |
I'll try to play with this more soon. Also this is a breaking change so probably we should wait for a few more breaking changes before merging. |
Oh, interesting - I didn't consider it breaking. What's the interface you're considering for the break? |
Anyone modifying the default Webpack config and looking at the stage names. |
Ah yes, there is that way to hook in. Thanks for the reminder. :0) |
I'm going to merge this for now. The ~33% speed decrease we can fix later by just building the bundle.js in another process (https://github.com/sindresorhus/execa looks nice). |
Which will actually probably speed up build times. |
I realized that the
noProductionJavascript
option wasn't quite right because it still generates a weird unminifiedpublic/bundle.js
, and you get no generatedstyles.css
. This pull request changes that.First, it makes the three stages in
util/webpack.config.js
a little easier to understand, renaming them to:Second, it moves
styles.css
generation to Stage 2, the 'build-static' stage.Third, it renames the temp webpack-generated file required by
static-site-generator-webpack-plugin
(previouslypublic/bundle.js
, so it was overwritten by the final webpack stage) topublic/render-page.js
and deletes it when Stage 2 is complete.