Update Webpack config for Webpack 4 API

pull/6479/head
Thibaud Colas 2020-05-29 00:39:20 +01:00 zatwierdzone przez Karl Hobley
rodzic ef2c177a7b
commit de2d66e08e
1 zmienionych plików z 17 dodań i 13 usunięć

Wyświetl plik

@ -16,12 +16,10 @@ const exposedDependencies = {
};
module.exports = function exports() {
const entry = {
// Create a vendor chunk that will contain polyfills, and all third-party dependencies.
vendor: [
'./client/src/utils/polyfills.js',
],
};
const entry = {};
// Create a vendor chunk that will contain polyfills, and all third-party dependencies.
entry[getOutputPath('admin', 'vendor')] = ['./client/src/utils/polyfills.js'];
entry[getOutputPath('admin', 'wagtailadmin')] = getEntryPath('admin', 'wagtailadmin.entry.js');
entry[getOutputPath('admin', 'draftail')] = getEntryPath('admin', 'draftail.entry.js');
@ -33,13 +31,6 @@ module.exports = function exports() {
filename: '[name].js',
publicPath: '/static/js/'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: getOutputPath('admin', '[name].js'),
minChunks: 2,
}),
],
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
@ -66,6 +57,19 @@ module.exports = function exports() {
}))
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
name: getOutputPath('admin', 'vendor'),
chunks: 'initial',
minChunks: 2,
reuseExistingChunk: true,
},
},
},
},
// See https://webpack.js.org/configuration/devtool/.
devtool: 'source-map',