Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

json messages is empty when use pnpm #204

Open
NateScarlet opened this issue May 14, 2021 · 5 comments
Open

json messages is empty when use pnpm #204

NateScarlet opened this issue May 14, 2021 · 5 comments
Labels
Type: Bug Bug or Bug fixes

Comments

@NateScarlet
Copy link

.include.add(path.resolve(__dirname, '../../', `./src/${localeDir}`))

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\\vue-cli-plugin-i18n@2.1.0\\src\\locales'
  ],
  use: [
    /* config.module.rule('i18n-resource').use('i18n-resource') */
    {
      loader: '@intlify/vue-i18n-loader'
    }
  ]
}
@NateScarlet
Copy link
Author

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

@kazupon
Copy link
Member

kazupon commented May 17, 2021

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.

@kazupon kazupon added the Type: Bug Bug or Bug fixes label May 17, 2021
@Rhilip
Copy link

Rhilip commented Mar 15, 2022

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,

I hope this project will support pnpm with fix the wrong include in localeDir

@Silbad
Copy link

Silbad commented Jun 17, 2022

Hello, same pb with vue-cli. How can I fix this?

@Silbad
Copy link

Silbad commented Jun 17, 2022

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug Bug or Bug fixes
Projects
None yet
Development

No branches or pull requests

4 participants