mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 23:24:39 +00:00
Update: upgrade to Webpack 4 & improve output size
Upgrade from Webpack v2.0.12 to v4.1.1. There have been many changes to Webpack... Noticeable in the bundle size is that a number of files are now inlined and generally minification is improved. Changes related to the upgrade include: - Remove unsupported UglifyJS options which link back to T188081. These appear to have been anticipatory but never acted on and it isn't clear whether they even worked or not. - Pass the -p plag for production optimizations; pass the -d flag since production doesn't support watching. - NamedModulesPlugin is now on by default but only in development mode so no change was made. - Webpack command line client now must be installed separated and appears in package.json as webpack-cli. https://github.com/webpack/webpack/releases/tag/v2.2.0 https://github.com/webpack/webpack/releases/tag/v2.2.1 https://github.com/webpack/webpack/releases/tag/v2.3.0 https://github.com/webpack/webpack/releases/tag/v2.3.1 https://github.com/webpack/webpack/releases/tag/v2.3.2 https://github.com/webpack/webpack/releases/tag/v2.3.3 https://github.com/webpack/webpack/releases/tag/v2.4.0 https://github.com/webpack/webpack/releases/tag/v2.4.1 https://github.com/webpack/webpack/releases/tag/v2.5.0 https://github.com/webpack/webpack/releases/tag/v2.5.1 https://github.com/webpack/webpack/releases/tag/v2.6.0 https://github.com/webpack/webpack/releases/tag/v2.6.1 https://github.com/webpack/webpack/releases/tag/v3.0.0 https://github.com/webpack/webpack/releases/tag/v3.1.0 https://github.com/webpack/webpack/releases/tag/v3.2.0 https://github.com/webpack/webpack/releases/tag/v3.3.0 https://github.com/webpack/webpack/releases/tag/v3.4.0 https://github.com/webpack/webpack/releases/tag/v3.4.1 https://github.com/webpack/webpack/releases/tag/v3.5.0 https://github.com/webpack/webpack/releases/tag/v3.5.1 https://github.com/webpack/webpack/releases/tag/v3.5.2 https://github.com/webpack/webpack/releases/tag/v3.5.3 https://github.com/webpack/webpack/releases/tag/v3.5.4 https://github.com/webpack/webpack/releases/tag/v3.5.5 https://github.com/webpack/webpack/releases/tag/v3.5.6 https://github.com/webpack/webpack/releases/tag/v3.6.0 https://github.com/webpack/webpack/releases/tag/v3.7.0 https://github.com/webpack/webpack/releases/tag/v3.7.1 https://github.com/webpack/webpack/releases/tag/v3.8.0 https://github.com/webpack/webpack/releases/tag/v3.8.1 https://github.com/webpack/webpack/releases/tag/v3.9.0 https://github.com/webpack/webpack/releases/tag/v3.9.1 https://github.com/webpack/webpack/releases/tag/v3.10.0 https://github.com/webpack/webpack/releases/tag/v3.11.0 https://github.com/webpack/webpack/releases/tag/v4.0.0 https://medium.com/webpack/webpack-4-released-today-6cdb994702d4 https://github.com/webpack/webpack/releases/tag/v4.0.1 https://github.com/webpack/webpack/releases/tag/v4.1.0 https://github.com/webpack/webpack/releases/tag/v4.1.1 Bug: T165036 Change-Id: Ic146e680d368fee7ee207b484460ce94f8bd7283
This commit is contained in:
parent
c2bb43b552
commit
d35286a064
3121
package-lock.json
generated
3121
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "webpack -w",
|
||||
"build": "NODE_ENV=production webpack",
|
||||
"start": "webpack -dw",
|
||||
"build": "NODE_ENV=production webpack -p",
|
||||
"test:node": "node tests/node-qunit/run.js 'tests/node-qunit/**/*.test.js' | tap-dot",
|
||||
"test:dev": "grunt lint && npm run test:node",
|
||||
"test": " npm run check-built-assets && npm run test:dev && npm run doc",
|
||||
|
@ -34,12 +34,13 @@
|
|||
"stylelint-config-wikimedia": "0.4.2",
|
||||
"svg-inline-loader": "0.8.0",
|
||||
"tap-dot": "^1.0.5",
|
||||
"webpack": "^2.6.0"
|
||||
"webpack": "4.1.1",
|
||||
"webpack-cli": "2.0.12"
|
||||
},
|
||||
"bundlesize": [
|
||||
{
|
||||
"path": "resources/dist/index.js",
|
||||
"maxSize": "12KB"
|
||||
"maxSize": "10.9KB"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.json
vendored
BIN
resources/dist/index.js.json
vendored
Binary file not shown.
|
@ -29,13 +29,11 @@ conf = {
|
|||
// with .json extension
|
||||
sourceMapFilename: '[file].json'
|
||||
},
|
||||
entry: {
|
||||
index: './src/index.js'
|
||||
},
|
||||
entry: { index: './src' },
|
||||
performance: {
|
||||
hints: isProduction ? 'error' : false,
|
||||
maxAssetSize: 38.9 * 1024,
|
||||
maxEntrypointSize: 38.9 * 1024,
|
||||
maxAssetSize: 32.9 * 1024,
|
||||
maxEntrypointSize: 32.9 * 1024,
|
||||
assetFilter: function ( filename ) {
|
||||
// The default filter excludes map files but we rename ours to .filename.
|
||||
return filename.endsWith( '.js' );
|
||||
|
@ -68,9 +66,8 @@ conf = {
|
|||
};
|
||||
|
||||
// Production settings.
|
||||
// Enable minification and dead code elimination with uglify. Define the
|
||||
// global process.env.NODE_ENV so that libraries like redux and redux-thunk get
|
||||
// development code trimmed.
|
||||
// Define the global process.env.NODE_ENV so that libraries like redux and
|
||||
// redux-thunk get development code trimmed.
|
||||
// Enable minimize flags for webpack loaders and disable debug.
|
||||
if ( isProduction ) {
|
||||
conf.plugins = conf.plugins.concat( [
|
||||
|
@ -82,22 +79,6 @@ if ( isProduction ) {
|
|||
'process.env': {
|
||||
NODE_ENV: JSON.stringify( 'production' )
|
||||
}
|
||||
} ),
|
||||
new webpack.optimize.UglifyJsPlugin( {
|
||||
sourceMap: true,
|
||||
// Preserve @nomin comments that disable ResourceLoader minification if
|
||||
// present. Right now a banner with @nomin is not being added since in
|
||||
// production mode the source-map comment will end up in a compound
|
||||
// bundle (as load.php will bundle a many modules in a single request)
|
||||
// thus breaking source-maps for other sources than the Popups ones. We
|
||||
// should add the @nomin banner in the future if ResourceLoader supports
|
||||
// combining/merging source-maps from different modules. For the moment,
|
||||
// the source map comment will be stripped in ResourceLoader's production
|
||||
// mode to not interfere with debugging other sources loaded alongside
|
||||
// Popups.
|
||||
//
|
||||
// See https://phabricator.wikimedia.org/T188081 for more info
|
||||
comments: /@nomin/
|
||||
} )
|
||||
] );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue