123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- const { defineConfig } = require('@vue/cli-service')
- module.exports = defineConfig({
- transpileDependencies: true,
- lintOnSave:false,
- publicPath: "./", // 公共路径(必须有的)
- outputDir: "bigData", // 输出文件目录
- assetsDir: "static", //静态资源文件名称
- productionSourceMap: false, //去除打包后js的map文件
- devServer: { //启动项目在8080端口自动打开
- host:"127.0.0.1",
- open: true,
- port: 8888,
- //proxy: null,
- 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',
- minSize: 50000, //构建出来的chunk大于30000才会被分割
- maxSize: 100000, //会尝试根据这个大小进行代码分割
- // 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')
- // }
- // }
- // }
- })
|