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

feat: 如何使用 ESM-only 的 webpack plugin? #780

Open
StephenPCG opened this issue Sep 11, 2024 · 0 comments
Open

feat: 如何使用 ESM-only 的 webpack plugin? #780

StephenPCG opened this issue Sep 11, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@StephenPCG
Copy link

StephenPCG commented Sep 11, 2024

What problem does this feature solve?

我使用 father 打包前端代码,输出为 umd,因此用 webpack 打包。项目使用了 unocss,之前使用都正常,功能满足预期。

unocss 的 webpack 插件(@unocss/webpackv0.59.0 开始改为 ESM-only,在 .fatherrc.ts 中无法使用(或者我不知道如何使用)。

我尝试过以下写法:

export default defineConfig({
  umd: {
    chainWebpack: (memo, args) => {
      import("@unocss/webpack").then(({default: UnoCSS}) => {
        memo.plugin('unocss').use(UnoCSS('./uno.config.ts'))
      })
    }
  }
})

但是并不 work,会报这样的错:TypeError [ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING]: A dynamic import callback was not specified.

请问现在的 father 是否支持 ESM-only 的 webpack 插件?如果支持,该如何配置?如果不支持,是否有计划添加支持?

Possible Solution (optional)

No response

@StephenPCG StephenPCG added the enhancement New feature or request label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant