-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Build: Remove Custom Bundler #16379
Build: Remove Custom Bundler #16379
Conversation
7b2b291
to
b48e941
Compare
Love this PR :) |
script(src=urls[ jsFile + '-min' ]) | ||
if chunk | ||
script(src=urls[ chunk + '-min' ]) | ||
script(src=urls[ 'manifest' ]) |
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.
This is might invalidate all cached files in the browser. Do we keep the same file names for production assets?
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.
I'm not sure I understand what you mean. Can you explain the problem a bit more?
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.
We need to make sure urls of JS files served on production remain the same. Otherwise returning visitors will have to load them again.
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.
they'll have to load them again when this change lands regardless. Changing the filename to drop the min should be fine...?
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.
agreed @blowery . I don't think there is an issue here
server/pages/index.js
Outdated
urls[ name + '-min' ] = asset.url.replace( '.js', '.min.js' ); | ||
} | ||
} ); | ||
forEach( assets, ( asset, name ) => urls[ name ] = asset.js ); |
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.
i'll admit it took me a minute to parse out that asset.js
was asset[ 'js' ]
and not a straight filename :D
webpack.config.js
Outdated
@@ -252,9 +258,9 @@ if ( process.env.DASHBOARD ) { | |||
webpackConfig.plugins.unshift( new DashboardPlugin() ); | |||
} | |||
|
|||
if ( process.env.WEBPACK_OUTPUT_JSON ) { | |||
if ( process.env.WEBPACK_OUTPUT_JSON || process.env.NODE_ENV === 'production' ) { | |||
webpackConfig.devtool = 'cheap-module-source-map'; |
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.
aside, but is this still the best source map to use?
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.
I actually think that with uglify on we need to turn on uglify's source maps instead: https://github.com/webpack-contrib/uglifyjs-webpack-plugin#options
} | ||
|
||
// run one minifier per cpu core | ||
async.eachLimit( files, os.cpus().length, minifyFile, done ) |
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.
yay one more async
dep gone
server/boot/index.js
Outdated
@@ -40,9 +39,6 @@ function setup() { | |||
// setup logger | |||
app.use( morgan( 'dev' ) ); | |||
} else { | |||
assets = require( 'bundler/assets' ); |
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.
how was this used server side?
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.
just to generate script tag urls as far as I can tell 🤔
I rudely put out a request for a release date of 1.0: webpack-contrib/uglifyjs-webpack-plugin#95 after that its full steam ahead with this pr! |
2b227e7
to
c156d68
Compare
I am currently in favor of pushing through with this PR using the current stable version built into webpack instead of waiting for the new 1.0 with parallel and caching. We'll be ready to accept the upgrade trivially when it comes out (in a month? impossible to know) and I believe moving forward sooner will make scope hoisting easier to adopt. I'll do a speed comparison so that its easier to weigh the tradeoff. |
turn on UglifyJSPlugin for production build enable parallel + file cache goodbye assets middleware! readFileSync instead so that first serve doesnt 500
0666f47
to
dbb7d71
Compare
build time for this PR on my machine (macbook pro 2016) was |
Closing because we merged: #18074 |
This PR Seeks to remove our custom bundler from the build process so that we can use
webpack
via cli.why
webpack.config.js
-->webpack.config.babel.js
speed. the uglification changes take advantage of both parallelization + a cache. will probably double our docker build speeds again :)how
the custom bundler only runs during prod builds and also only does two things.
We should wait for the soon-to-be-merged uglification parallelization: feat: add support forparallelization
&&caching
(options.parallel
) webpack-contrib/uglifyjs-webpack-plugin#77wait for 1.0 releaseTo Test:
run calypso in these environemnts: