Repository: next.js
Issue: v13.4.10 SSG export won't work for me with i18next while v13.4.9 works / Strange fix is required to get it working
Labels: bug

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
    Binaries:
      Node: 16.17.0
      npm: 9.8.1
      Yarn: N/A
      pnpm: 7.11.0
    Relevant Packages:
      next: 13.4.12
      eslint-config-next: 13.4.12
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A
```


### Which area(s) of Next.js are affected? (leave empty if unsure)

Static HTML Export (output: "export")

### Link to the code that reproduces this issue or a replay of the bug

https://github.com/xairoo/next-i18next-static-site/tree/dev-next-v13.4.10

### To Reproduce

I have created two branches to test it, it's a turbo monorepo, the only difference between the two branches is the Next.js version:
- v13.4.9 / works / [live preview @ Cloudflare](https://2cfdbdf2.next-i18next-static-site.pages.dev/)  
  https://github.com/xairoo/next-i18next-static-site/tree/dev-next-v13.4.9

- v13.4.10 / fails / [live preview @ Cloudflare](https://ce6c442c.next-i18next-static-site.pages.dev/)  
  https://github.com/xairoo/next-i18next-static-site/tree/dev-next-v13.4.10


While in `/` run `npm ci` and then you can go to `examples/web` and run `npm run export && npm run serve`.
`npm run dev` just works, also the export doesn't produce an error, only when you access the page.

This error will appear in the browsers console:
```js
Error: You are passing a wrong module! Please check the object you are passing to i18next.use()
```

# Dirty fix
_I solved it but I have no idea why and it feels totally wrong_.
While playing around I added `console.log(initReactI18next);` before calling `i18next.use()` and it worked (dev & export).

Instead of printing it, I can also use run this _twice_: `plugins.map((plugin) => i18next.use(plugin));`

Location: https://github.com/xairoo/next-i18next-static-site/blob/12840c6d40fb0f5cf2b8229c5b288252d7924489/packages/next-i18next-static-site/src/index.tsx#L55

```js
const createI18nextInstance = (locales, language) => {
  const plugins = [
    initReactI18next,
  ];

  plugins.map((plugin: Module) => i18next.use(plugin)); // Or console.log(initReactI18next);
  plugins.map((plugin: Module) => i18next.use(plugin));

  i18next.init({
    resources: locales,
    cleanCode: true,
    lng: language,
    supportedLngs: config.languages,
    fallbackLng: language ? language : config.defaultLanguage,
    ns: config.namespaces, // String or array of namespaces to load
    defaultNS: config.defaultNamespace, // Default namespace used if not passed to translation function
    interpolation: {
      escapeValue: false, // Not needed for react as it escapes by default
    },
    react: {
      useSuspense: false, // Not compatible with SSR
    },
    load: "languageOnly", // Remove if you want to use localization (en-US, en-GB)
  });

  return i18next;
};
```

Any ideas why this works? I really have no idea and it feels totally wrong and it worked with all Next.js versions before v13.4.10.

### Describe the Bug

I use `i18next` with [next-i18next-static-site](https://github.com/xairoo/next-i18next-static-site) to create Next.js SSG exports.
But it suddenly stopped working when I updated to the latest Next.js version.
It works while in dev mode without problems, but accessing the build will fail, the build finished without an error.

```
Error: You are passing a wrong module! Please check the object you are passing to i18next.use()
```

Finally I updated all dependencies one by one to narrow it down and it stopped working with `next` v13.4.10, it still works fine with v13.4.9.

I have posted this issue at the i18next repo before (https://github.com/i18next/i18next/issues/2013), but it looks like it's up to Next.js.

### Expected Behavior

The SSG export should work like it does while in dev.

### Which browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_