Skip to content
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

vue-i18n does not work with Nuxt 3.7.2 without transpiling #1546

Closed
4 tasks done
mcrapts opened this issue Sep 13, 2023 · 0 comments · Fixed by #1548
Closed
4 tasks done

vue-i18n does not work with Nuxt 3.7.2 without transpiling #1546

mcrapts opened this issue Sep 13, 2023 · 0 comments · Fixed by #1548
Labels
Status: Review Needed Request for review comments

Comments

@mcrapts
Copy link

mcrapts commented Sep 13, 2023

Reporting a bug?

Integrating vue-i18n into a Nuxt 3.7 application according to the instructions results in the following error when building and running the application:

[nuxt] [request error] [unhandled] [500] Cannot find module '/home/projects/github-hnz7et-dysose/.output/server/chunks/dist/vue-i18n.runtime.mjs' imported from /home/projects/github-hnz7et-dysose/.output/server/chunks/app/server.mjs

It works fine in dev.

Expected behavior

No error.

Reproduction

https://stackblitz.com/edit/github-hnz7et-dysose?file=nuxt.config.ts

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.20.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.6.10 - /usr/local/bin/pnpm
  npmPackages:
    @intlify/unplugin-vue-i18n: ^1.2.0 => 1.2.0 
    vue-i18n: ^9.4.0 => 9.4.0 

Screenshot

No response

Additional context

It might be just a documentation error according Daniel Roe from Nuxt: nuxt/nuxt#23180 (comment)

This workaround seems to work without issues.

  // https://nuxt.com/docs/api/configuration/nuxt-config
  import VueI18nPlugin from '@intlify/unplugin-vue-i18n';
  
  export default defineNuxtConfig({
    devtools: { enabled: true },
+   build: {
+     transpile: [/vue-i18n/]
+   },
    vite: {
      plugins: [
        VueI18nPlugin.vite({
          /* options */
  
        }),
      ],
    },
  });

Validations

@mcrapts mcrapts added the Status: Review Needed Request for review comments label Sep 13, 2023
kazupon added a commit that referenced this issue Sep 14, 2023
kazupon added a commit that referenced this issue Sep 14, 2023
kazupon added a commit that referenced this issue Sep 14, 2023
* docs: add build.transpile option

resolve #1546

* fix: cannot resolve linked refer message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review Needed Request for review comments
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant