Vue CLI3 config

npm run build remove console

https://s0babeljs0io.icopy.site/docs/en/babel-plugin-transform-remove-console

Installation

npm install babel-plugin-transform-remove-console --save-dev

Usage

babel.config.js

const plugins = ['@vue/babel-plugin-transform-vue-jsx']
if (process.env.NODE_ENV === 'production') {
  plugins.push('transform-remove-console')
}
module.exports = {
  plugins: plugins,
  presets: [
    [
      '@vue/app'
    ]
  ]
}

minity to js

https://github.com/webpack-contrib/uglifyjs-webpack-plugin

Installation

npm install uglifyjs-webpack-plugin --save-dev

Usage

vue.config.js

const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
  configureWebpack: {
    optimization: {
      minimizer: [new UglifyJsPlugin()]
    }
  }
}

你可能感兴趣的:(Vue CLI3 config)