-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
pkg: Use webpack 5 by default #48
Conversation
3ed67cd
to
b5968c6
Compare
This isn't a good idea unless we can restore "everyone else's" behavior of polyfilling node core modules, which is required to correctly bundle node modules. |
@ljharb Yeah, I saw that in people's reactions to webpack 5. I'll add a TODO item here to incorporate that behavior so this doesn't land without solving that problem. |
2d46bd4
to
15b4ecd
Compare
@@ -184,6 +186,7 @@ export default function makeBaseConfig({ | |||
'node_modules', | |||
], | |||
extensions: ['.js', '.ts', '.tsx', '.scss', '.json'], | |||
alias: webpack.version.startsWith('4') ? {} : NODE_ALIAS, |
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.
seems more reliable to use the semver
library here, but i suppose by the time webpack 40 comes out, this code will be different :-p
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.
exactly. deprecating 4 support will happen long before then :P
pkg: Use sass instead of node-sass fix: Make devserver static asset serving consistent BREAKING CHANGE: Dev mode static assets /assets/${buildDir} -> /${buildDir} (By default this means /assets/dist/ -> /dist/) pkg: html plugin fixes compat issue fix: sass-loader filecache compat pkg: Bump style-only-imports fix: polyfill node builtins for web target fix: More comprehensive node polyfill pkg: Maintain 4 compatibilitly
Since webpack 5 is final, let's use it as primary target. Webpack 4 will still be supported for the foreseeable future.
Build times
Done on examples/typescript project (with antd). Machine: Threadripper 2950x, Samsung 970 Pro, WSL2 on Win10.
4:
Cold prod build: ~28 seconds
Hot prod build: ~17 seconds
Aggregate size: 327kb gzip
Entry size (vendor non-react): 67kb gzip
5:
Cold prod build: ~17 seconds
Hot prod build: ~5 seconds
Aggregate size: 298kb gzip
Entry size (vendor non-react): 53kb gzip
Improvement:
Must fix:
Warnings:
--watch
flag webpack/webpack-cli#1918Future work:
Other changes:
Testing: