Closed Vestibule closed 1 year ago
@Vestibule Thank you for your reporting!
I've tried to reproduce your reporting! Unfortunately, I could not that issue... 😞
I've put the repro repo https://github.com/kazupon/vue-i18n-next-repro-719
Could you modify some reproduction code, please? 🙏
Hi @kazupon Thank you for you quick response.
I tried to reproduce the issue on your repo but I didn't succeed. I can't explain to myself what is going wrong here, as the package.json is strictly the same for your repo and my project. The vendor.js should be changed only by changes in the package.json, right ? Also, I tried to remove i18n from my project and the issue disappeared.
I'm a bit lost here and don't know what to do next.
npmPackages: vue: ^3.1.4 => 3.2.9 vue-i18n: ^9.0.0 => 9.1.7
I noticed vue-i18n v9.0.x is used in your package.json Could you try to use the vue-i18n v9.1.x (latest v9.1.8) please?
I tried with 9.1.8, nothing changed.
Hmm...
Could you try to build with minify off (vite build --minify false
), please?
We can get the details of stacktrace.
Closing due to inactivity. Please open a new issue with a reference to this one if you can follow up with more information.
Thanks!
I've encountered same issue when running npm run build
:(
I get
Uncaught TypeError: Sg.version.split is not a function
When I click on error line in console it brings to this :
["object", "boolean", "number", "function", "string", "symbol"].forEach(function(e, t) {
bf[e] = function(n) {
return typeof n === e || "a" + (t < 1 ? "n " : " ") + e
}
});
var Eg = {}
, tT = Sg.version.split("."); // <-------- Here the error happens
function wg(e, t) {
for (var r = t ? t.split(".") : tT, n = e.split("."), i = 0; i < 3; i++) {
if (r[i] > n[i])
return !0;
if (r[i] < n[i])
return !1
}
return !1
}
My package.json
setup is (anything vite related) :
"@intlify/vite-plugin-vue-i18n": "^3.2.0",
"vue-i18n": "^9.2.0-beta.20",
"@intlify/vite-plugin-vue-i18n": "^3.2.0",
"@vitejs/plugin-vue": "^1.9.4",
"vite": "^2.6.14",
"vite-plugin-imagemin": "^0.4.6",
My vite.config.ts
:
import { defineConfig } from "laravel-vite";
import vue from "@vitejs/plugin-vue";
import viteImagemin from "vite-plugin-imagemin";
import vueI18n from '@intlify/vite-plugin-vue-i18n'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import Components from 'unplugin-vue-components/vite'
export default defineConfig()
.withPlugin(vue)
.withPlugin(vueI18n())
.withPlugin(Components({
resolvers: IconsResolver(),
}))
.withPlugin(Icons({
compiler: 'vue3',
}))
.withPlugin(
viteImagemin({
gifsicle: {
optimizationLevel: 7,
interlaced: false,
},
optipng: {
optimizationLevel: 7,
},
mozjpeg: {
quality: 77,
},
pngquant: {
quality: [0.8, 0.9],
speed: 4,
},
svgo: {
plugins: [
{
name: "removeComments",
},
{
name: "removeTitle",
},
{
name: "removeDimensions",
},
],
},
})
);
Just do add more information, This is how I initialize i18n in my app.js
file :
import { createI18n } from 'vue-i18n'
createInertiaApp({
setup({ el, App, props, plugin }) {
const i18n = createI18n({
legacy: false,
locale: props.initialPage.props.locale,
});
createApp({
render: () => h(App, props)
})
.use(i18n)
And this is how I use it in my SFC (just like the docs example) :
<script>
import { useI18n } from 'vue-i18n'
export default {
const { locale, t } = useI18n({
inheritLocale: true
})
return {
t,
}
}
</script>
<i18n>
{
"en": {
"hello": "hello, world!"
},
"ja": {
"hello": "こんにちは、世界!"
}
}
</i18n>
( I have removed the extra codes to keep it simple )
Here is what I tried :
runtimeOnly
to falseresolve.alias
like so :
resolve: {
alias: {
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
}
},
vue-i18n
from ^9.2.0-beta.20
to ^9.0.0
node_modules
and package-lock.json
and re-run npm i
Btw sorry if I missed any guidelines or anything for posting the issue, I tried to put as much as info I could though
I faced the exact same problem and updated axios to "^0.26.0"
in my package.json. This fixed the issue - To be honest, kinda hard to explain why this shows up in this specific vendor chunk, but give it a try.
I faced the exact same problem and updated axios to
"^0.26.0"
in my package.json. This fixed the issue - To be honest, kinda hard to explain why this shows up in this specific vendor chunk, but give it a try.
I've tried your suggestion but it still throws the error for me on npm run build
>﹏<
I'm not sure what to do... I need to build a multi lang app and this issue doesn't let me use this package... currently looking for an alternative
I think I found the source of this problem ( more like I found the culprit, not the actual source ), it's the @intlify/vite-plugin-vue-i18n
plugin. If I remove that from vite config, vue-i18n
( during npm run build
) will just work fine! 😄
I ran into the same issue and wanted to share how I solved it.
vite build --minify
as suggested abovevite.config.ts
to identify which package was the culprit
build: {
rollupOptions: {
manualChunks: {
"vue-i18n": ["vue-i18n"],
...etc...
},
"pnpm": {
"overrides": {
"axios": "^0.26.1"
}
}
in my root package.json
(npm and yarn probably have something similar)
Had same issue. I was also depending on older version of axios.
When minified, it seemed as if it was related to i18n but when turned minification off, then it was clear that it was not related to i18n at all but it was axios version error.
Thank you for reporting!
We need a solution to this issue, but we need the minimue reproduction code that can actually confirm the issue with anyone. we need a github repo or stackbliz where anyone can reproduce the issue.
After this comment, I will close this thread once there is no reproduction code provided in github repo or stackbliz.
We appreciate your understanding :)
close in-activity
Reporting a bug?
Hi,
Thanks for this great package.
I'm running into an issue on a project with Vue 3 and Vite. You'll find my package.json below. When I run a
yarn build
(which basically does avite build
), it builds without problem. Then when I serve the freshly built file withyarn serve
, I encounter this issue :Uncaught TypeError: au.version.split is not a function at vendor.1dcb0327.js:32
. When I check where is exactly the issue, it happens to be the 'built version' of the package core-base:Step to reproduce:
I hope we'll find a solution :)
Have a nice weekend. Cheers from Paris.
Expected behavior
The packaged javascript should run without error once built with Vite.
Reproduction
System Info
Screenshot
No response
Additional context
No response
Validations