i18next/i18next-http-middleware

Cannot build when targeting `/cjs` with Node 14

isaachinman opened this issue · 7 comments

When importing i18next-http-middleware/cjs in Node 14, the following error occurs:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './cjs' is not defined by "exports" in /next-i18next/examples/simple/node_modules/i18next-http-middleware/package.json
    at applyExports (internal/modules/cjs/loader.js:492:9)
    at resolveExports (internal/modules/cjs/loader.js:508:23)
    at Function.Module._findPath (internal/modules/cjs/loader.js:632:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1001:27)
    at Function.Module._load (internal/modules/cjs/loader.js:884:27)
    at Module.require (internal/modules/cjs/loader.js:1074:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at eval (eval at _default (/next-i18next/examples/simple/.next/server/static/Is5pI6bYEY6qbsIXDLIqW/pages/_app.js:10253:31), <anonymous>:1:1)
    at _default (/next-i18next/examples/simple/.next/server/static/Is5pI6bYEY6qbsIXDLIqW/pages/_app.js:10253:31)
    at new NextI18Next (/next-i18next/examples/simple/.next/server/static/Is5pI6bYEY6qbsIXDLIqW/pages/_app.js:9923:66) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
adrai commented

Can you create a reproducable repo? Or is this the build of next-i18next?

adrai commented

I have an idea...
Can you try locally if this would work?
image

adrai commented

Can you create a reproducable repo? Or is this the build of next-i18next?

Ahh it's this: next-i18next/examples/simple

adrai commented

ok...
seeems this works... will imediately publish a new version

    "./cjs": {
      "default": "./cjs/index.js"
    }
adrai commented

i18next-http-middleware@1.0.1

adrai commented

i18next-http-backend@1.0.8

@adrai That's working great, thanks for a quick response.