babel: [Bug]: Failed to transpile arrow functions even I saw "transform-arrow-functions { ie } " from log and I have not exclude /node_modules/

💻

  • Would you like to work on a fix?

How are you using Babel?

babel-loader (webpack)

Input code

In webpack.config.js I have commented out exclude: /node_modules/

        rules: [
            {
                test: /\.js$/,
                // exclude: /node_modules/,
                use: ['babel-loader']
            }
          ...

Configuration file name

.babelrc

Configuration

"production": {
            "presets": [
                [
                    "@babel/preset-env",
                    {
                        "targets": {
                            "chrome": "94",
                             ie: '10'
                        },
                        "modules": "commonjs",
                        "debug": true,
                        "useBuiltIns": "usage",
                        "shippedProposals": true,
                        "corejs": "3.33"
                    }
                ]
            ],
            "plugins": [["@babel/plugin-transform-runtime", {}]]
        }

Current and expected behavior

I see from the log

> BABEL_ENV='production' webpack --mode production

@babel/preset-env: `DEBUG` option

Using targets:
{
  "chrome": "94",
  "ie": "10",
}

Using modules transform: commonjs

Using plugins:
  proposal-class-static-block { ie, safari }
  ...
  transform-arrow-functions { ie }
  ...

But checking the result

ag --js -c "=>{" ./dist/
dist/phonebar.js:7
dist/index.js:7

Environment

 System:
    OS: macOS 14.0
  Binaries:
    Node: 16.20.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.4 - /usr/local/bin/npm
  npmPackages:
    @babel/core: ^7.0.0 => 7.20.5
    @babel/plugin-transform-runtime: ^7.0.0 => 7.19.6
    @babel/preset-env: ^7.0.0 => 7.20.2
    @babel/runtime-corejs3: ^7.12.13 => 7.20.6
    babel-eslint: ^10.0.1 => 10.1.0
    babel-loader: ^8.0.0 => 8.3.0
    babelify: ^8.0.0 => 8.0.0
    eslint: ^5.11.0 => 5.16.0
    gulp-babel: ^7.0.1 => 7.0.1
    webpack: ^4.37.0 => 4.46.0

Possible solution

No response

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 29 (10 by maintainers)

Most upvoted comments

It seems that

const namespaces = [...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace)

comes from https://github.com/debug-js/debug/blob/f66cb2d9f729e1a592e72d3698e3b75329d75a25/src/common.js#L197

Can you run the build process with BABEL_SHOW_CONFIG_FOR=./node_modules/debug/src/common.js?