Skip to content
Snippets Groups Projects
Verified Commit f29af223 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Configure webpack chunks by vendor

parent 0d5d60ec
No related branches found
No related tags found
1 merge request!1045Introduce Vuetify and GraphQL
......@@ -16,7 +16,8 @@ module.exports = {
},
output: {
path: path.resolve('./assets/webpack_bundles/'),
filename: "[name]-[hash].js"
filename: "[name]-[hash].js",
chunkFilename: "[id]-[chunkhash].js",
},
plugins: [
new BundleTracker({filename: './webpack-stats.json'}),
......@@ -65,6 +66,29 @@ module.exports = {
},
],
},
optimization: {
runtimeChunk: "single",
splitChunks: {
chunks: "all",
maxInitialRequests: Infinity,
minSize: 0,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name(module) {
// get the name. E.g. node_modules/packageName/not/this/part.js
// or node_modules/packageName
const packageName = module.context.match(
/[\\/]node_modules[\\/](.*?)([\\/]|$)/
)[1];
// npm package names are URL-safe, but some servers don't like @ symbols
return `npm.${packageName.replace("@", "")}`;
}
}
}
}
},
resolve: {
modules: [path.resolve('./node_modules')],
alias: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment