test: resolve('src/components'), // can customize your rules minChunks: 3, // minimum common number priority: 5, reuseExistingChunk: true } } }) // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk config.optimization.runtimeChunk('single') } ) } Css相关配置 /...
*/configureWebpack:(config) =>{if(process.env.NODE_ENV==='production') {// 为生产环境修改配置...config.mode='production'// 将每个依赖包打包成单独的js文件letoptimization = {runtimeChunk:'single',splitChunks: {chunks:'all',maxInitialRequests:Infinity,minSize:20000,// 依赖包超过20000bit将被...
// 将 runtime 作为内联引入不单独存在 inline: /runtime\..*\.js$/ } ]) .end() config.optimization.splitChunks({ chunks: 'all', cacheGroups: { // cacheGroups 下可以可以配置多个组,每个组根据test设置条件,符合test条件的模块 commons: { name: 'chunk-commons', test: resolve('src/components')...
config.optimization.runtimeChunk("single"); }); } };
configureWebpack:config=>{// if (isProduction) {// 开启分离jsconfig.optimization={// runtimeChunk: 'single',splitChunks:{chunks:'all',maxInitialRequests:Infinity,maxSize:100000,//1000是1kbcacheGroups:{vendor:{test:/[\\/]node_modules[\\/]/,name(module){// get the name. E.g. node_mod...
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm }, ECharts: { name: 'chunk-ECharts', priority: 20, test: /[\\/]node_modules[\\/]_?echarts(.*)/ // in order to adapt to cnpm } } }) // config.optimization.runtimeChunk('single') } }...
optimization: { runtimeChunk: 'single', splitChunks: { chunks: 'all', maxInitialRequests: Infinity, minSize: 120000, maxSize: 250000, cacheGroups: { vendor: { test: /[\\/]node_modules[\\/]/, name(module) { const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)...
("src/service"));/* 别名配置 */config.optimization.runtimeChunk("single");},devServer:{// host: "localhost",/* 本地ip地址 *///host: "192.168.1.63",host:"192.168.1.63",//局域网和本地访问port:"8080",hot:true,/* 自动打开浏览器 */open:true,overlay:{warning:false,error:true},/*...
// use administrator privileges to execute the command line.// For example, Mac: sudo npm run // You can change the port by the following methods:// port = 9999 npm run dev OR npm run dev --port = 9999 const port = process.env.port || process.env.npm_config_port || 9999 // ...
config.optimization={ splitChunks: { cacheGroups: { vendors: { name: 'vendor', } } } } Asset Size Chunks Chunk Names app.e8019b78.js 73.7 KiB 0 [emitted] [immutable] app bg.jpg 82.6 KiB [emitted] index.html 303 bytes [emitted] styles.3ae8a7d8.css 5.31 KiB 0 [emitted] app ...