nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.72k stars 477 forks source link

fix: `node_modules` paths in runtime configuration payload #3022

Open dargmuesli opened 3 months ago

dargmuesli commented 3 months ago

Environment

Reproduction

will submit if necessary

Describe the bug

The Google search console shows countless "Not found (404)" errors to me for paths to language files that are not available in a production build, i.e. paths to files inside node_modules:

image

You can check out my website's source code and search for node_modules. You'll see that those paths:

window.__NUXT__.config={
  "public": {
    "i18n": {
      "configLocales": [
        {
          "code": "en",
          "name": "English",
          "iso": "en",
          "files": [
            "../node_modules/.pnpm/@dargmuesli+nuxt-vio@13.2.1_@lezer+common@1.2.1_@types+eslint@8.56.10_@unocss+webpack@0.61.3__onw6a5qdvo7xolh5mymdy7mkeu/node_modules/@dargmuesli/nuxt-vio/locales/en.json",
            "locales/en.json"
          ]
        },
      ],
...

@dargmuesli/nuxt-vio being a layer of mine.

Apparently Google picks those paths up, but I guess they are of no use here as node_modules shouldn't be available in a project built for production, right?

Any reason to keep these paths here? Should they be corrected maybe or removed? I hope this report helps, would love to assist!

Additional context

I wonder why those paths are picked up, as I don't see any network request being tried to those paths.

Logs

No response

BobbieGoede commented 3 months ago

Hmm I guess Google tries to crawl anything that resembles a link 🤔 Did not think they would also try paths in javascript variables 😂

It's worth looking into removing these paths from production builds as long as these are not used after build.