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

npm run generate produces absolute path to my language files #3188

Closed
kokhoor opened this issue Oct 25, 2024 · 3 comments · Fixed by #3235
Closed

npm run generate produces absolute path to my language files #3188

kokhoor opened this issue Oct 25, 2024 · 3 comments · Fixed by #3235

Comments

@kokhoor
Copy link

kokhoor commented Oct 25, 2024

Environment

Nuxt:: ^3.12.2
@nuxtjs/i18n: ^8.5.5

Reproduction

My nuxt.config.js:

modules: [
  ...
  "@nuxtjs/i18n",
  ...
],
i18n: {
    locales: [
      {
        code: "en",
        file: "en.json"
      },
      {
        code: "cn",
        file: "cn.json"
      }
    ],
    lazy: true,
    strategy: "no_prefix",
    langDir: "lang",
    defaultLocale: "en"
  },

Then I generate using npm run generate.

Describe the bug

I have following nuxt.config.js (snippet)

modules: [
  ...
  "@nuxtjs/i18n",
  ...
],
i18n: {
    locales: [
      {
        code: "en",
        file: "en.json"
      },
      {
        code: "cn",
        file: "cn.json"
      }
    ],
    lazy: true,
    strategy: "no_prefix",
    langDir: "lang",
    defaultLocale: "en"
  },

When I do an npm run generate, my index.html content for the nuxt config portion has configLocales that contains absolute path:

configLocales:[{code:"en",files:["C:/mynuxt/en.json"]},{code:"cn",files:["C:/mynuxt/lang/cn.json"]}]

How do I fix this?

Additional context

No response

Logs

No response

@adesombergh
Copy link

+1, I have my personal local file path hard-coded into all generated pages on a production site (yeety.be, just search "/Users" in the source-code of any page)

@adesombergh
Copy link

Realized this thanks to Google Search Console detecting a bunch of 404

@lceihen
Copy link

lceihen commented Nov 11, 2024

+1, and how can i resolve this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants