ice icon indicating copy to clipboard operation
ice copied to clipboard

某些情况下bablePlugin失效

Open aak1247 opened this issue 1 year ago • 1 comments

Describe the bug

间接依赖中使用了高版本axios,用到async generator语法,开启minify后 esbuild无法transform

Expected behavior

正常编译

Actual behavior

ERR! WEBPACK HookWebpackError: Transform failed with 2 errors:
ERR! WEBPACK js/index.4f8396b638781611c0d7.js:183158:18: ERROR: Transforming async generator functions to the configured target environment ("es2016") is not supported yet
ERR! WEBPACK js/index.4f8396b638781611c0d7.js:183164:19: ERROR: Transforming async generator functions to the configured target environment ("es2016") is not supported yet
ERR! WEBPACK     at makeWebpackError (D:\xxxx\node_modules\.pnpm\@[email protected]\node_modules\@builder\pack\deps\webpack\bundle5.js:68022:9)
ERR! WEBPACK     at D:\xxxx\node_modules\.pnpm\@[email protected]\node_modules\@builder\pack\deps\webpack\bundle5.js:51531:12   
ERR! WEBPACK     at eval (eval at create (D:\xxxx\node_modules\.pnpm\@[email protected]\node_modules\@builder\pack\deps\webpack\bundle5.js:40256:10), <anonymous>:68:1)
ERR! WEBPACK     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Version of ice.js

2.6.6

Content of build.json or ice.config.mts

{
  "eslint": true,
  "store": true,
  "dropLogLevel": "log",
  "hash": "contenthash",
  "modeConfig": {
    "dev": {
      "sourceMap": true
    },
    "test": {
      "sourceMap": true
    },
    "uat": {
      "sourceMap": true
    }
  },
  "minify": {
    "type": "esbuild",
    "options": {
      "target": "es2016",
      "css": true
    }
  },
  "plugins": [
    [
      "build-plugin-antd",
      {
        "themeConfig": {
          "primary-color": "#205FED"
        }
      }
    ],
    [
      "build-plugin-moment-locales",
      {
        "locales": ["zh-cn"]
      }
    ],
    [
      "build-plugin-icestark",
      {
        "uniqueName": "frameworkJsonp"
      }
    ],
    "./build.plugin.js"
  ],
  "babelPresets": [["@babel/preset-react", { "runtime": "automatic" }]],
  "babelPlugins": [
    "@babel/plugin-proposal-async-generator-functions"
  ],
  "compileDependencies": ["axios"],
  "browserslist": {
    "chrome": 49,
    "ie": 11
  }
}

Additional context

No response

aak1247 avatar Nov 11 '24 23:11 aak1247

提供个复现 case 看下,看配置应该已经编译了 axios 了

ClarkXia avatar Nov 12 '24 02:11 ClarkXia