babel.config.js 768 B

123456789101112131415161718192021222324252627282930313233343536
  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. "component",
  16. {
  17. "libraryName": "element-ui",
  18. "styleLibraryName": "theme-chalk"
  19. }
  20. ])
  21. module.exports = {
  22. presets: [
  23. '@vue/cli-plugin-babel/preset',
  24. [
  25. '@babel/preset-env',
  26. {
  27. 'useBuiltIns': 'entry',
  28. 'corejs': 3
  29. }
  30. ]
  31. ],
  32. plugins
  33. }