|
@@ -14,38 +14,96 @@ module.exports = defineConfig({
|
|
|
proxy: process.env.VUE_APP_ENV === 'production' ? 'https://www.aaa.com/' : 'https://gateway.bbb.com/'
|
|
|
|
|
|
},
|
|
|
+ chainWebpack(config) {
|
|
|
+ config
|
|
|
+ .when(process.env.VUE_APP_ENV !== 'www.dlc.com',
|
|
|
+ config => {
|
|
|
+ config
|
|
|
+ .plugin('ScriptExtHtmlWebpackPlugin')
|
|
|
+ .after('html')
|
|
|
+ .use('script-ext-html-webpack-plugin', [{
|
|
|
+ // `runtime` must same as runtimeChunk name. default is `runtime`
|
|
|
+ inline: /runtime\..*\.js$/
|
|
|
+ }])
|
|
|
+ .end()
|
|
|
+ config
|
|
|
+ .optimization.splitChunks({
|
|
|
+ chunks: 'all',
|
|
|
+ cacheGroups: {
|
|
|
+ libs: {
|
|
|
+ name: 'chunk-libs',
|
|
|
+ test: /[\\/]node_modules[\\/]/,
|
|
|
+ priority: 10,
|
|
|
+ chunks: 'initial'
|
|
|
+ },
|
|
|
+ elementUI: {
|
|
|
+ name: 'chunk-elementUI',
|
|
|
+ priority: 20,
|
|
|
+ test: /[\\/]node_modules[\\/]_?element-plus(.*)/,
|
|
|
+ chunks: 'initial'
|
|
|
+ },
|
|
|
+ echarts: {
|
|
|
+ name: 'chunk-echarts',
|
|
|
+ priority: 20,
|
|
|
+ test: /[\\/]node_modules[\\/]_?echarts(.*)/,
|
|
|
+ },
|
|
|
+ flv: {
|
|
|
+ name: 'chunk-flv',
|
|
|
+ priority: 20,
|
|
|
+ test: /[\\/]node_modules[\\/]_?flv(.*)/
|
|
|
+ },
|
|
|
+ jsJquery: {
|
|
|
+ name: 'chunk-jquery',
|
|
|
+ priority: 20,
|
|
|
+ test: /[\\/]node_modules[\\/]_?jquery(.*)/
|
|
|
+ },
|
|
|
+ mqtt: {
|
|
|
+ name: 'chunk-mqtt',
|
|
|
+ priority: 20,
|
|
|
+ test: /[\\/]node_modules[\\/]_?mqtt(.*)/
|
|
|
+ },
|
|
|
+ mqttPacket: {
|
|
|
+ name: 'chunk-mqtt-packet',
|
|
|
+ priority: 20,
|
|
|
+ test: /[\\/]node_modules[\\/]_?mqtt-packet(.*)/
|
|
|
+ },
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
//去掉console
|
|
|
- configureWebpack: (config) => {
|
|
|
- // 判断为生产模式下,因为开发模式我们是想保存console的
|
|
|
- if (process.env.NODE_ENV === "production") {
|
|
|
- config.optimization.minimizer.map((arg) => {
|
|
|
- const option = arg.options.terserOptions.compress;
|
|
|
- option.drop_console = true; // 打开开关
|
|
|
- return arg;
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- configureWebpack: {
|
|
|
- // 关闭 webpack 的性能提示
|
|
|
- // performance: {
|
|
|
- // hints:false
|
|
|
- // }
|
|
|
-
|
|
|
- // //或者
|
|
|
-
|
|
|
- // 警告 webpack 的性能提示
|
|
|
- performance: {
|
|
|
- hints: 'warning',
|
|
|
- // 入口起点的最大体积
|
|
|
- maxEntrypointSize: 50000000,
|
|
|
- // 生成文件的最大体积
|
|
|
- maxAssetSize: 30000000,
|
|
|
- // 只给出 js 文件的性能提示
|
|
|
- assetFilter: function (assetFilename) {
|
|
|
- return assetFilename.endsWith('.js')
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // configureWebpack: (config) => {
|
|
|
+ // // 判断为生产模式下,因为开发模式我们是想保存console的
|
|
|
+ // if (process.env.NODE_ENV === "production") {
|
|
|
+ // config.optimization.minimizer.map((arg) => {
|
|
|
+ // const option = arg.options.terserOptions.compress;
|
|
|
+ // option.drop_console = true; // 打开开关
|
|
|
+ // return arg;
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // configureWebpack: {
|
|
|
+ // // 关闭 webpack 的性能提示
|
|
|
+ // // performance: {
|
|
|
+ // // hints:false
|
|
|
+ // // }
|
|
|
+ //
|
|
|
+ // // //或者
|
|
|
+ //
|
|
|
+ // // 警告 webpack 的性能提示
|
|
|
+ // performance: {
|
|
|
+ // hints: 'warning',
|
|
|
+ // // 入口起点的最大体积
|
|
|
+ // maxEntrypointSize: 50000000,
|
|
|
+ // // 生成文件的最大体积
|
|
|
+ // maxAssetSize: 30000000,
|
|
|
+ // // 只给出 js 文件的性能提示
|
|
|
+ // assetFilter: function (assetFilename) {
|
|
|
+ // return assetFilename.endsWith('.js')
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
})
|
|
|
|
|
|
|