babel / babel-loader

📦 Babel loader for webpack
MIT License
4.83k stars 451 forks source link

[Bug]: #1017

Closed jisao closed 3 months ago

jisao commented 10 months ago

💻

How are you using Babel?

babel-loader (webpack)

Input code

ERROR in ./node_modules/@ant-design/icons/node_modules/@ctrl/tinycolor/dist/module/index.js 23:35 Module parse failed: Unexpected token (23:35) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | this.a = rgb.a; | this.roundA = Math.round(100 * this.a) / 100;

    this.format = opts.format ?? rgb.format;

| this.gradientType = opts.gradientType; | // Don't let the range of [0,255] come back in [0,1]. @ ./node_modules/@ant-design/icons/node_modules/@ctrl/tinycolor/dist/module/public_api.js 1:0-27 1:0-27 @ ./node_modules/@ant-design/icons/node_modules/@ant-design/colors/es/generate.js @ ./node_modules/@ant-design/icons/node_modules/@ant-design/colors/es/index.js @ ./node_modules/@ant-design/icons/es/components/AntdIcon.js @ ./node_modules/@ant-design/icons/es/icons/CheckOutlined.js @ ./node_modules/antd-v5/es/steps/index.js @ ./node_modules/antd-v5/es/index.js @ ./src/components/Layout/customer-service/index.tsx @ ./src/pages/App.tsx @ ./src/entry/main/before/index.tsx @ ./src/entry/main/index.js @ multi ./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js ./src/entry/main/index.js

Configuration file name

No response

Configuration

{ "presets": [["@babel/preset-env", { "modules": false, "useBuiltIns": "usage", "corejs": "3" }], "@babel/preset-react", "@babel/preset-typescript"], "plugins": [ ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": true }], "@babel/transform-runtime", ["@babel/plugin-proposal-decorators", { "legacy": true }], "@babel/plugin-proposal-class-properties" ],

"comments": false,
"env": {
    "test": {
        "presets": ["@babel/preset-env", "@babel/preset-stage-0", "@babel/preset-react"],
        "plugins": ["@babel/plugin-transform-runtime"]
    },
    "production": {
        "plugins": ["transform-remove-console"]
    }
}

}

Current and expected behavior

"@babel/core": "7.22.8", "@babel/helper-create-regexp-features-plugin": "7.22.15", "@babel/helper-plugin-utils": "7.22.5", "@babel/plugin-proposal-class-properties": "7.8.3", "@babel/plugin-proposal-decorators": "7.8.3", "@babel/plugin-syntax-jsx": "7.23.3", "@babel/plugin-transform-runtime": "7.9.0", "@babel/polyfill": "7.12.1", "@babel/preset-env": "7.23.3", "@babel/preset-react": "7.23.3", "@babel/preset-stage-0": "7.8.3", "@babel/preset-typescript": "7.23.3", "babel-eslint": "10.0.3", "babel-jest": "24.9.0", "babel-loader": "8.3.0", "babel-plugin-import": "1.13.8", "babel-plugin-transform-remove-console": "6.9.4", "babel-preset-react-app": "9.1.2",

Environment

"@babel/core": "7.22.8", "@babel/helper-create-regexp-features-plugin": "7.22.15", "@babel/helper-plugin-utils": "7.22.5", "@babel/plugin-proposal-class-properties": "7.8.3", "@babel/plugin-proposal-decorators": "7.8.3", "@babel/plugin-syntax-jsx": "7.23.3", "@babel/plugin-transform-runtime": "7.9.0", "@babel/polyfill": "7.12.1", "@babel/preset-env": "7.23.3", "@babel/preset-react": "7.23.3", "@babel/preset-stage-0": "7.8.3", "@babel/preset-typescript": "7.23.3", "babel-eslint": "10.0.3", "babel-jest": "24.9.0", "babel-loader": "8.3.0", "babel-plugin-import": "1.13.8", "babel-plugin-transform-remove-console": "6.9.4", "babel-preset-react-app": "9.1.2",

Possible solution

No response

Additional context

No response

babel-bot commented 10 months ago

Hey @jisao! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

JLHwung commented 10 months ago

?? is ES2020 syntax and webpack 4 does not support it. Please upgrade webpack to version 5.