-
Notifications
You must be signed in to change notification settings - Fork 28
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
build以后,vit preview 会报Uncaught ReferenceError: require is not defined #9
Comments
Please provide a reproduction repo. By the way, it looks like a problem of @rollup/plugin-commonjs. |
感谢使用 build: {
commonjsOptions: {
transformMixedEsModules: true,
},
} Thanks for using This issue can be solved with the build: {
commonjsOptions: {
transformMixedEsModules: true,
},
} |
原来如此,那是否应该文档说明一些这属于dev环境的呢?还有一点疑惑的是:rollup的插件配置到plugin中,那么也只是影响build吗,dev是否也会作用呢 |
vite默认就启用了
|
你说vite默认就启用了@rollup/plugin-commonjs,不需要配置,指的是dev环境是吗?其实build的话,还是需要单独对@rollup/plugin-commonjs做一些配置的,比如transformMixedEsModules默认false,如果不改为ture,我试了下就会报require 未定义; |
|
我在配置之后出现了 |
I have the same problem, have you already solved it? |
getting the same error here, I switching back to use vite-plugin-i18n-resources. |
transformMixedEsModules配置为true后,问题还是存在 ‘require is not defined’ |
if (a) { if (b) { if (c) { |
Awesome, finally sovled my problem!!! Confusing SUI SDK ( |
我的也是动态引入,也是开启了一样报错,请问最后你的问题解决了么 |
你的问题解决了吗 |
vite 可能忽略了这个参数 transformMixedEsModules #648 |
为什么我配置上,打包预览还是会报require is not defined? |
transformMixedEsModules:true,打包还是报 require is not defined |
已经放弃require的使用。。。 |
安装的最新版本,viteconfig配置:
入口文件:
这个插件打包不支持吗
The text was updated successfully, but these errors were encountered: