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

使用第三包时报错,not provide an export named 'default' #759

Closed
zhanqp opened this issue Aug 28, 2020 · 2 comments
Closed

使用第三包时报错,not provide an export named 'default' #759

zhanqp opened this issue Aug 28, 2020 · 2 comments

Comments

@zhanqp
Copy link

zhanqp commented Aug 28, 2020

比如使用mockjs等npm包时,由于打包后的文件是commonjs的,会出现如下错误
Uncaught SyntaxError: The requested module '/@modules/mockjs/src/mock.js' does not provide an export named 'default'
有没有好的解决方法

@antfu
Copy link
Member

antfu commented Aug 28, 2020

The best way is to file an issue to mockjs asking for providing ESM builds. For the general support, please track on #720.

@antfu antfu closed this as completed Aug 28, 2020
@underfin
Copy link
Member

You also can used
optimizeDeps inside vite.config.js by bundle it to es module(doc is here https://github.com/vitejs/vite/blob/master/src/node/config.ts#L96)

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants