-
Notifications
You must be signed in to change notification settings - Fork 149
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
[WIP] Upgraded Webpack to v4 #471
Conversation
WARNING: this still crashes. will look into it later.
This should now work. Note that benchmarks still necessary. Also in this commit: * Removed autoprefixer-loader in favour of postcss-loader chaining autoprefixer and postcss-flexbugs fixes * Updated browserslist config for autoprefixer
@dtinth The scripts should now work well with webpack 4! Note that this is still a very first attempt of getting it to work, more improvements could be done I think. (note how I haven't converted everything to using Also, since the generated bundles now look different, it'd be a good idea to run a quick benchmark comparing Also for future reference: https://developers.google.com/web/fundamentals/performance/webpack/decrease-frontend-size |
removed DefinePlugin in favour of `mode`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, thanks, this looks really good!
Thanks for upgrading the webpack configuration and migrate several stuff to use the best practices (e.g. using module.rules
instead of inline loader syntax, and replacing autoprefixer-loader
).
Feel free to merge when you think it’s stable enough! :D
@dtinth Yeah, we're almost done. Although two new test cases failures due to the change in how we load Also I have yet to figure out how |
Update: Service workers are also broken with this upgrade, will rewrite + bring it up to date w/ the current best practices of including a service worker. Currently looking at |
@dtinth
|
Never mind. I've just been stupid all this time. SW's actually work. |
4bf50eb
to
f22d83b
Compare
@resir014 The interface of module.exports = 'module.exports = 42' Now, it must look like this: module.exports = () => ({ code: 'module.exports = 42' }) I think it is fine to keep using |
@resir014 I just pushed a commit to make it build successfully for now 😄. |
@dtinth Thanks! :D As soon as we can figure out what causes the promise rejection failures in the tests, this should be ready to merge. Unfortunately, I've been trying to track down the issue for weeks but nothing came up 😓 |
@resir014 No worries, I will take care of it. Strangely enough, when running tests directly (http://localhost:8080/?mode=test) they all pass, but when run in Karma it does not work. This may have to do with karma-webpack and its interaction with the web server (this may be related but not sure: codymikol/karma-webpack#295). |
I did a weird workaround about karma-webpack (problem shown in the linked thread), somehow, in this branch it did not work anymore. However, the bug in karma-webpack has been merged and released in karma-webpack@2.0.10. This should now work :D |
Ah, I remember now! I specified
The loader reference has been moved into I hope this clears up the confusion, and sorry for causing you the trouble of tracking down a very subtle bug. This should be mergeable now, yay 😄 |
@dtinth Ah I see now! Yep, all green now. I'm merging this. Thanks for your help! ❤️ |
Fixes #453
Very early work, but I'll continue working on it over the next week. Feedbacks appreciated.
## Also in this PR* The current service worker method will not work with Webpack 4. I'm currently attempting to rewrite it using more modern Webpack plugins, likesw-precache-webpack-plugin
. Currently looking atcreate-react-app
's Service Worker setup and implementing portions of it here.* Note that service worker will only load if the app is compiled underproduction
mode (since sw-precache-webpack-plugin doesn't support WDS), so a new local server setup will probably have to be built. (see this link for example). This will be available on the npm tasks list asnpm run start:prod
.Never mind. I've just been stupid all this time. SW's actually work.