babel.config.js 670 B

123456789101112131415161718192021222324252627282930
  1. const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
  2. const IS_PREVIEW = process.env.VUE_APP_PREVIEW === 'true'
  3. const plugins = []
  4. if (IS_PROD && !IS_PREVIEW) {
  5. // 去除日志的插件,
  6. plugins.push('transform-remove-console')
  7. }
  8. // lazy load ant-design-vue
  9. // if your use import on Demand, Use this code
  10. plugins.push(['import', {
  11. 'libraryName': 'ant-design-vue',
  12. 'libraryDirectory': 'es',
  13. 'style': true // `style: true` 会加载 less 文件
  14. }])
  15. module.exports = {
  16. presets: [
  17. '@vue/cli-plugin-babel/preset',
  18. [
  19. '@babel/preset-env',
  20. {
  21. 'useBuiltIns': 'entry',
  22. 'corejs': 3
  23. }
  24. ]
  25. ],
  26. plugins
  27. }