Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack 配置babel对node_modules下的ahooks进行编译,会有很多/* unused harmony default export */ #2611

Closed
4innocent opened this issue Jul 25, 2024 · 2 comments
Labels
🤔 Need Reproduce We cannot reproduce your problem

Comments

@4innocent
Copy link

webpack 5.93.0
babel 7.24.9

webpack 配置babel对ahooks进行编译,会有很多/* unused harmony default export */
项目里仅使用了useRequest,所以我测试了swr没有这种情况,babel-loader配置代码如下:

{
  test: /(axios)|(uuid)|(ahooks)/,
  use: {
    loader: "babel-loader",
    options: {
      presets: [
        [
          "@babel/preset-env",
          {
            targets: ["ie >= 9"], 
            useBuiltIns: "entry",
            corejs: 3, // 使用 core-js@3 版本
          },
        ],
      ],
    },
  },
},

其他tree-shaking webpack配置有:

optimization: {
  usedExports: true, // treeshaking
}
"sideEffects": [
  "*.css"
]

配置了polyfill后应该能够支持ie的

@crazylxr
Copy link
Collaborator

麻烦来个可以复现的demo

@crazylxr crazylxr added the 🤔 Need Reproduce We cannot reproduce your problem label Jul 26, 2024
Copy link

Hello @4innocent. Please provide a online reproduction by forking this link https://codesandbox.io/s/ok2fe or a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 3 days.

你好 @4innocent, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 Need Reproduce We cannot reproduce your problem
Projects
None yet
Development

No branches or pull requests

2 participants