-
Notifications
You must be signed in to change notification settings - Fork 692
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
关于vitePress打包时报错这个问题? #787
Comments
我修复下这个问题 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
环境:
"vitepress": "1.0.0-rc.44",
"vue": "3.3.4",
"vite": "^4.3.9",
"vue-cropper": "^1.1.1",
复现情况:
开发环境:一切正常,功能完整
正式环境:(package.json启用了type: "module")
1. 打包时出现报错,如下截图,从报错可以看出是打包的格式问题,不支持ES module。
2. 然后换个思路,在vite -> ssr -> noExternal设置中将vue-cropper加入非外部化来避免es转换,继续打包出现如下报错
ssr: {
noExternal: ['vue-cropper']
}
从报错中可以看出是代码中使用了File对象,vitepress目标产物是在node环境中,没有提供这些全局对象,导致报错,这个地方需要处理
The text was updated successfully, but these errors were encountered: