Hygiene: replace deprecated Webpack plugin

Replace NamedModulesPlugin with `optimisations.namedModules = true`. Not
to be confused with `optimization.namedModules` which is deprecated.

https://github.com/webpack/webpack/releases/tag/v4.0.0
https://github.com/webpack/webpack/releases/tag/v4.16.0

Bug: T212527
Change-Id: Ie5c7b74e294b012f270de8a6ebc660bf5e75d478
This commit is contained in:
Stephen Niedzielski 2019-01-04 16:51:04 +00:00 committed by Jdlrobson
parent f2c1e787bc
commit c8c93d0859

View file

@ -1,6 +1,6 @@
/* global __dirname, process */
const path = require( 'path' ),
webpack = require( 'webpack' ),
const
path = require( 'path' ),
CleanPlugin = require( 'clean-webpack-plugin' ),
PUBLIC_PATH = '/w/extensions/Popups',
isProduction = process.env.NODE_ENV === 'production';
@ -38,7 +38,14 @@ const conf = {
optimization: {
// Don't produce production output when a build error occurs.
noEmitOnErrors: isProduction
noEmitOnErrors: isProduction,
// Use filenames instead of unstable numerical identifiers for file references. This
// increases the gzipped bundle size some but makes the build products easier to debug and
// appear deterministic. I.e., code changes will only alter the bundle they're packed in
// instead of shifting the identifiers in other bundles.
// https://webpack.js.org/guides/caching/#deterministic-hashes (namedModules replaces NamedModulesPlugin.)
namedModules: true
},
output: {
@ -61,12 +68,7 @@ const conf = {
devtool: 'source-map',
plugins: [
new CleanPlugin( distDir, { verbose: false } ),
// To generate identifiers that are preserved over builds, webpack supplies
// the NamedModulesPlugin (generates comments with file names on bundle)
// https://webpack.js.org/guides/caching/#deterministic-hashes
new webpack.NamedModulesPlugin()
new CleanPlugin( distDir, { verbose: false } )
],
performance: {