babel: Unexpected token: name (absPath)

Bug Report

Current Behavior util/const/index.js:

var linkReplaceFunction = function () {
  let absPath = arguments[0];
  // ...

util/.babelrc:

{
  "presets": [
    "@babel/preset-env",
    [
      "@babel/preset-stage-0",
      {
        "decoratorsLegacy": true
      }
    ]
  ]
}

App/webpack.config.js:

   [
      {
        test: /\.(js|jsx)$/,
        exclude: /(node_modules|aliyun-sdk)/,
        use: [{
          loader: 'babel-loader',
        }],
      },
   ]

App/.babelrc:

{
  "presets": [
    "@babel/preset-env",
    "@babel/preset-react",
    ["@babel/preset-stage-0",{"decoratorsLegacy": true}]
  ],
  "plugins": [
    "transform-decorators-legacy",
    [
      "import",
      {
        "libraryName": "antd",
        "style": false
      }
    ]
  ]
}

Environment

  • Babel version(s): 7.0.0-beta.47
  • Node/npm version: 7.3
  • webpack 3.11.0

Possible Solution babel doesn’t work on util but work well on app

Additional context/Screenshots Add any other context about the problem here. If applicable, add screenshots to help explain.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

How do you compile the files under util/? Do you use the webpack config in App for them?