-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Module is a CommonJS module, which may not support all module.exports as named exports. #220
Comments
The same error with @intlify/unplugin-vue-i18n 0.8.2
|
我也遇见类似的问题,我是在项目中集成了
|
Well, for solve this error i removed i18n from project, and tried to use self-written package for internationalization. |
@alivadjid, The issue is with the Vite plugin However, it is very sad that the declared functionality of this plugin does not work. |
@alivadjid 我也有类似的问题,我找到了一个折衷方案,希望能够帮助到您,下方是我的的配置:(I have similar problems. I have found a compromise that I hope will help you. Below is my configuration:) ssr: {
/**
* 由于在 build 时会报错 SyntaxError: Named export 'createI18n' not found.
* The requested module 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js' is a CommonJS module, which may not support all module.exports as named exports.
* 所以要添加以下配置。详见:https://vite-plugin-ssr.com/common-issues 与 https://vite-plugin-ssr.com/invalid-esm#solution
*/
noExternal: ['vue-i18n']
} |
@WangJincheng4869 Your solution fixed my production build but then I could not start my App in dev mode anymore ("module not found"). I uninstalled unplugin-vue-i18n and used vue-i18n directly and now it works in dev and prod. |
to do some special case in vite config file. |
Reporting a bug?
Hello!
I'm using vite-ssr-plugin with vue3 and i18n with unplugin-vue-i18n
On build mode I have an error. But on dev mode everything is great.
Found this comment about this problem, intlify/vue-i18n#1131 (comment)
And explanation vuejs/core#4814 (comment)
Also there are solution for
vite-plugin-vue-i18n
#172But I can't find solutions for
unplugin-vue-i18n
Also opened issue in repo vite-plugin-ssr vikejs/vike#634
If change ssr parameter in vite.config.ts - building is successfull.
According to the documentation ssr can be customized with 4 keys. I'm trying to find out wich key is causing build error.
Expected behavior
No error on build mode
Reproduction
Issue Package
unplugin-vue-i18n
System Info
Linux 5.15.0-58-generic #64-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
Screenshot
Additional context
In vite.config.ts config file
createI18n used in app.ts with this:
Validations
The text was updated successfully, but these errors were encountered: