0

When I run my Vue project, it's throwing an error in the terminal:

Syntax Error: Error: [BABEL] /Volumes/A/workspace/website20/src/pages/about/main.js: @babel/preset-env: The plugins/built-ins 'es.const, es.let' passed to the 'exclude' option are not
    valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env (While processing: "/Volumes/A/workspace/website20/node_modules/@vue/cli-plugin-babel/preset.js.overrides[0]$0")
    at Generator.next (<anonymous>)
    at Generator.next (<anonymous>)
    at Generator.next (<anonymous>)

I think my env is wrong, but I don't know where;

My env:

babel.config.js

module.exports = {
  presets: [
    [
      '@vue/cli-plugin-babel/preset', {
        polyfills: [
          'es.array.iterator',
          'es.object.assign',
          'es.promise',
          'es.promise.finally',
          'es.array.find',
          'es.const',
          'es.let',
          'es.map',
          'es.set',
          // 'es.reflect',
        ],
      },
    ],
  ],
  plugins: [
    ['import', { libraryName: 'ant-design-vue', libraryDirectory: 'es', style: true }],
  ],
};

Can anyone help me? Thanks;

======================

Maybe because after execute npx browserslist@latest --update-db;

HongYu
  • 11
  • 2

1 Answers1

0

I had the exact same problem and after hours of looking for a solution I found that adding this to the package.json of your app fixes the problem:

"browserslist": [
"defaults",
"not IE 11",
"maintained node versions"]

For more info about browserslist just go to: https://github.com/browserslist/browserslist