babel.config.js 547 B

12345678910111213141516171819202122232425
  1. const prodPlugin = []
  2. if (process.env.NODE_ENV === 'production') {
  3. // 如果是生产环境,则自动清理掉打印的日志,但保留error 与 warn
  4. prodPlugin.push([
  5. 'transform-remove-console',
  6. {
  7. // 保留 console.error 与 console.warn
  8. exclude: ['error', 'warn']
  9. }
  10. ])
  11. }
  12. module.exports = {
  13. presets: ["@vue/cli-plugin-babel/preset"],
  14. plugins: [
  15. [
  16. "import",
  17. {
  18. libraryName: "vant",
  19. libraryDirectory: "es",
  20. style: true
  21. }
  22. ],...prodPlugin
  23. ]
  24. };