zhengnaiwen_citu 6 месяцев назад
Родитель
Сommit
b1977d3efb
1 измененных файлов с 9 добавлено и 23 удалено
  1. 9 23
      vue.config.js

+ 9 - 23
vue.config.js

@@ -5,11 +5,6 @@ const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
 // 配置编辑器
 const Timestamp = new Date().getTime()
 
-// if (process.env.NODE_ENV === 'production') {
-//   fs.writeFile('./public/version.json', JSON.stringify({ version: Timestamp }), () => {
-//     console.log('新版本号生成成功')
-//   })
-// }
 module.exports = defineConfig({
   // 项目部署的基本路径,默认 '/'
   publicPath: '/',
@@ -84,30 +79,21 @@ module.exports = defineConfig({
         return options
       })
     })
-    // config.plugin('generate-version-file').use({
-    //   apply: (compiler) => {
-    //     // 生成当前时间戳
-    //     // const timestamp = Date.now()
-
-    //     // 构造 version.json 内容
-
-    //     const versionData = {
-    //       version: Timestamp
-    //     }
-
-    //     // 写入 version.json 文件
-    //     if (process.env.NODE_ENV === 'production') {
-    //       fs.writeFileSync('./public/version.json', JSON.stringify(versionData, null, 2))
-    //     }
-    //   }
-    // })
-    // config.output.chunkFilename('js/[name].[contenthash].js').end()
   },
   // babel-loader 是否处理 node_modules 中的依赖包,处理哪些依赖包,参数类型: boolean | Array<string | RegExp>
   transpileDependencies: [
     'axios',
     'element-ui'
   ],
+  // 移除console
+  terser: {
+    terserOptions: {
+      compress: {
+        drop_console: true,
+        drop_debugger: true
+      }
+    }
+  },
   css: {
     loaderOptions: {
       sass: {