Browse Source

chore: add LOGGER to control drop_console

it is disabled by default, drop_console will be true
Casper Dai 3 years ago
parent
commit
3b3e4a2ed9
3 changed files with 6 additions and 4 deletions
  1. 2 0
      .env
  2. 1 0
      feature.js
  3. 3 4
      vue.config.js

+ 2 - 0
.env

@@ -1,5 +1,7 @@
 ENV = 'currency'
 
+LOGGER = 'disabled'
+
 # 未开发的功能组件
 __PLACEHOLDER__ = 'disabled'
 # 传感器

+ 1 - 0
feature.js

@@ -15,6 +15,7 @@ function getTimestamp () {
 module.exports = {
   isProd,
   isStaging,
+  logger: isStaging || isEnable('LOGGER'),
   features: {
     __VERSION__: JSON.stringify(`v${require('./package.json').version}.${getTimestamp()}`),
     // 未开发完的路由

+ 3 - 4
vue.config.js

@@ -3,7 +3,7 @@ const path = require('path')
 const webpack = require('webpack')
 const {
   isProd,
-  isStaging,
+  logger,
   features
 } = require('./feature')
 
@@ -138,14 +138,13 @@ module.exports = {
               }
             }
           })
-          // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
+        // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
         config
           .optimization.runtimeChunk('single')
-          // optimization
         config
           .optimization.minimizer('terser').tap(args => {
             // clear console.x
-            args[0].terserOptions.compress.drop_console = !isStaging
+            args[0].terserOptions.compress.drop_console = !logger
             return args
           })
       })