You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The exports map added in 12.1.0 break import 'react-i18next' / import("react-i18next") statements in node.js (require('react-i18next') still working fine).
Last working version
Worked up to version: 12.0.0
Stopped working in version: 12.1.0
To Reproduce
Steps to reproduce the behavior:
Install react-18next@12.1.0
Run node --experimental-specifier-resolution=node --input-type module --eval 'import { I18nextProvider } from "react-i18next"'
Expected behavior
Should not crash. (Note a warning about experimental node flags will be printed)
Actual behaviour
Crashes with the following error:
node --experimental-specifier-resolution=node --input-type module --eval 'import { I18nextProvider } from "react-i18next"'
(node:89634) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
******[eval1]:1
import { I18nextProvider } from "react-i18next"
^^^^^^^^^^^^^^^
SyntaxError: Named export 'I18nextProvider' not found. The requested module 'react-i18next' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'react-i18next';
const { I18nextProvider } = pkg;
Potential fixes
Use .mjs instead of .js extension to let node know the files are in ESM format (i.e. dist/es/index.mjs instead of dist/es/index.js)
Create a dist/package.json file with the contents { "type": "module" } to let node know the files are in ESM format.
Your Environment
runtime version: node 16, 18, 19
i18next version: n/a
os: Mac
The text was updated successfully, but these errors were encountered:
If you like this module don’t forget to star this repo. Make a tweet, share the word or have a look at our https://locize.com to support the devs of this project.
💥 Regression Report
The exports map added in 12.1.0 break
import 'react-i18next'
/import("react-i18next")
statements in node.js (require('react-i18next')
still working fine).Last working version
Worked up to version: 12.0.0
Stopped working in version: 12.1.0
To Reproduce
Steps to reproduce the behavior:
node --experimental-specifier-resolution=node --input-type module --eval 'import { I18nextProvider } from "react-i18next"'
Expected behavior
Should not crash. (Note a warning about experimental node flags will be printed)
Actual behaviour
Crashes with the following error:
Potential fixes
.mjs
instead of.js
extension to let node know the files are in ESM format (i.e.dist/es/index.mjs
instead ofdist/es/index.js
)dist/package.json
file with the contents{ "type": "module" }
to let node know the files are in ESM format.Your Environment
The text was updated successfully, but these errors were encountered: