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

使用 bundle模式,生成umd文件时,报错 #512

Open
lyj2209914083 opened this issue Mar 24, 2023 · 2 comments
Open

使用 bundle模式,生成umd文件时,报错 #512

lyj2209914083 opened this issue Mar 24, 2023 · 2 comments

Comments

@lyj2209914083
Copy link

报错信息如下:
No name was provided for external module 'http' in output.globals – guessing 'require$$1'
No name was provided for external module 'https' in output.globals – guessing 'require$$2$1'
No name was provided for external module 'url' in output.globals – guessing 'require$$0$1'
No name was provided for external module 'stream' in output.globals – guessing 'require$$3'
报错截图如下:
image

最后虽然成功生成了umd文件,但是使用时会报对应变量不存在的错误,截图如下:
image

@luhc228
Copy link
Member

luhc228 commented Mar 24, 2023

你的依赖中有 Node 原生模块(http/url 等),你可以试下加入这个插件:
https://www.npmjs.com/package/rollup-plugin-polyfill-node

不过 require$$1 这个应该是产物里的内容吧?

@lyj2209914083
Copy link
Author

我试了加入这个插件,但是仍然是一样的效果
打包配置:
image
对应的插件:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants