[Vuejs]-How to correctly set optimization.splitChunks.automaticNameDelimiter value using Webpack chain syntax?

2👍

Try this. more info

// vue.config.js
module.exports = {
  productionSourceMap: false,
  publicPath: '/app/',
  chainWebpack: config => {
        config.optimization.splitChunks({
            ...config.optimization.get('splitChunks'),
            automaticNameDelimiter: '-'
        })
  }
}

1👍

Webpack Chain module also exposes the merge(...) method on chained maps like config.optimization. You could use this as an alternative and less verbose syntax:

// vue.config.js
module.exports = {
  productionSourceMap: false,
  publicPath: '/app/',
  chainWebpack: (config) => {
    config.optimization.merge({
      splitChunks: { 
        automaticNameDelimiter: '-'
      }
    });
  },
};

Leave a comment