vue-cli-plugin-i18n
vue-cli-plugin-i18n copied to clipboard
json messages is empty when use pnpm
https://github.com/intlify/vue-cli-plugin-i18n/blob/fdc4fc04e1e9d3955907b47d9151f50d6530d2dc/index.js#L31
pnpm store package in a different way, so ../../src
is not point to project src folder
vue inspect --rule i18n-resource
/* config.module.rule('i18n-resource') */
{
test: /\.(json5?|ya?ml)$/,
type: 'javascript/auto',
include: [
'${workspaceFolder}\\node_modules\\.pnpm\\[email protected]\\src\\locales'
],
use: [
/* config.module.rule('i18n-resource').use('i18n-resource') */
{
loader: '@intlify/vue-i18n-loader'
}
]
}
workaround:
config.module
.rule('i18n-resource')
.include.clear()
.add(resolve(__dirname, 'src/locales'));
i18n plugin should search nearest node_modules
or use a different default value for pnpm
Thank you for your reporting!
sorry, I don't usually use pnpm much, so I wasn't able to test it. I will fix this issue later.
workaround:
config.module .rule('i18n-resource') .include.clear() .add(resolve(__dirname, 'src/locales'));
i18n plugin should search nearest
node_modules
or use a different default value for pnpm
this issue and workaround help me a lot. Many vue project like vue3, vite has switch to pnpm now,
- https://github.com/vuejs/core/pull/4766
- https://github.com/vitejs/vite/pull/5060
- https://github.com/intlify/vue-i18n-next/pull/731
- https://github.com/vueuse/vueuse/commit/826351ba1d9c514e34426c85f3d69fb9875c7dd9
I hope this project will support pnpm with fix the wrong include
in localeDir
Hello, same pb with vue-cli. How can I fix this?
ok I fixed it in the vue.config.js
chainWebpack: config => {
config.module
.rule('i18n-resource')
.include.clear()
.add(path.resolve(__dirname, 'src/locales'));
}
Thanks