I have to modify filenames when build vuejs project with webpack.
I'm using webpack 4.x.x vuejs 2.x.x version.
And have to modify file name of "vendors.js" and "runtime.js" to "vendors.pc.js" and "runtime.pc.js"
Can I change them when build it?
CodePudding user response:
add this to your webpack.config.js, then webpack will map node_modules files into different chunk files according to your cacheGroups settings
optimization: {
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
maxInitialRequests: Infinity,
minSize: 0,
cacheGroups: {
reactVendor: {
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
name: "reactvendor"
},
utilityVendor: {
test: /[\\/]node_modules[\\/](lodash|moment|moment-timezone)[\\/]/,
name: "utilityVendor"
},
bootstrapVendor: {
test: /[\\/]node_modules[\\/](react-bootstrap)[\\/]/,
name: "bootstrapVendor"
},
vendor: {
test: /[\\/]node_modules[\\/](!react-bootstrap)(!lodash)(!moment)(!moment-timezone)[\\/]/,
name: "vendor"
},
},
},
}
CodePudding user response:
The configuration file for Webpack The settings, plugins, loaders, and other components needed to construct the JavaScript portion of the NativeScript application are all included in the file called webpack. config. js. The NativeScript application's root contains the file.