babel.config.js 763 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
  2. const plugins = []
  3. if (IS_PROD) {
  4. plugins.push('transform-remove-console')
  5. }
  6. // lazy load ant-design-vue
  7. // if your use import on Demand, Use this code
  8. plugins.push(
  9. [
  10. 'import',
  11. {
  12. libraryName: 'ant-design-vue',
  13. libraryDirectory: 'es',
  14. style: true // `style: true` 会加载 less 文件
  15. }
  16. ],
  17. [
  18. 'import',
  19. {
  20. libraryName: 'plglib',
  21. libraryDirectory: 'components',
  22. style: 'css' // `style: true` 会加载 less 文件
  23. },
  24. 'plglib'
  25. ]
  26. )
  27. module.exports = {
  28. presets: [
  29. '@vue/cli-plugin-babel/preset',
  30. [
  31. '@babel/preset-env',
  32. {
  33. useBuiltIns: 'entry',
  34. corejs: 3
  35. }
  36. ]
  37. ],
  38. plugins
  39. }