Could not find plugin “proposal-numeric-separator”

后端 未结 18 1184
情深已故
情深已故 2020-12-08 00:04

How to fix Could not find plugin \"proposal-numeric-separator\", I get this error when I try to build my React application, I have not ejected the application y

18条回答
  •  孤街浪徒
    2020-12-08 00:36

    Why this problem happened?:

    It's an issue of conflicts between internal packages used by babel.

    Adding a new plugin to @babel/compat-data breaks old @babel/preset-env versions. This is because preset-env iterates over compat-data's plugins, and throws if the plugin isn't defined in preset-env's available-plugins.js file.

    This is the merge that fixed the issue: https://github.com/babel/babel/pull/11201/files/a88a00750c61ff89f1622d408d67108719f21ecd

    Solution:

    • Delete package-lock.json or yarn.lock
    • Delete node_modules folder
    • In package.jon I have adjusted the version numbers of these packages to:
        ...
        "devDependencies": {
            "@babel/compat-data": "^7.8.0",
            "@babel/preset-env": "^7.8.0",
            "babel-loader": "^8.1.0",
            ...
        },
        ...
        "resolutions": {
            "@babel/preset-env": "^7.8.0"
        }
    
    • Run npm install
    • Run npm run build

提交回复
热议问题