rollup-plugin-react-refresh icon indicating copy to clipboard operation
rollup-plugin-react-refresh copied to clipboard

Package fails in last nodejs versions with ERR_PACKAGE_PATH_NOT_EXPORTED

Open vzaidman opened this issue 2 months ago • 0 comments

In the last Node.js versions, only exported files can be imported via an absolute path.

This is why the library doesn't work on these. It fails with the error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './cjs/react-refresh-runtime.development.js' is not defined by "exports" in C:\Users\xx\projects\why-did-you-render\node_modules\react-refresh\package.json
    at exportsNotFound (node:internal/modules/esm/resolve:314:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:661:9)
    at resolveExports (node:internal/modules/cjs/loader:654:36)
    at Function._findPath (node:internal/modules/cjs/loader:753:31)
    at Function._resolveFilename (node:internal/modules/cjs/loader:1396:27)
    at Function.resolve (node:internal/modules/helpers:145:19)
    at Object.<anonymous> (C:\Users\xx\projects\why-did-you-render\node_modules\rollup-plugin-react-refresh\index.js:3:39)
    at Module._compile (node:internal/modules/cjs/loader:1740:14)
    at Object..js (node:internal/modules/cjs/loader:1905:10)
    at Module.load (node:internal/modules/cjs/loader:1474:32) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v23.5.0

I'm creating a PR to fix that. Stay tuned.

vzaidman avatar Dec 28 '24 22:12 vzaidman