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
We are using pidtree in a large node project with many modules. Our project is all ESM but it depends on a number of npm modules which are a mix of ESM and commonjs. When we upgraded to node 22 recently we found that pidtree as it is seems to upset the node static analysis of other commonjs modules, causing them not to load, eg with errors like this:
import { Emitter } from "@socket.io/component-emitter";
^^^^^^^
SyntaxError: Named export 'Emitter' not found. The requested module '@socket.io/component-emitter' 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 '@socket.io/component-emitter';
const { Emitter } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:180:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:263:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:578:26)
Removing our use of pidtree made the errors go away. I believe this is a node bug, but unfortunately I have not yet been successful in creating a minimal reproduction of the issue - everything just works as expected with a small/simple project of only a few modules. Without a simple repro I don't see a lot of point in opening an issue on the core node project.
Anyway, we wanted to continue using pidtree as it is useful so I refactored it to ESM which made the problem go away. I will create a PR in case you wish to consider this for merger, and also thought this issue might be useful to others if they encounter the same issue.
The text was updated successfully, but these errors were encountered:
We are using pidtree in a large node project with many modules. Our project is all ESM but it depends on a number of npm modules which are a mix of ESM and commonjs. When we upgraded to node 22 recently we found that pidtree as it is seems to upset the node static analysis of other commonjs modules, causing them not to load, eg with errors like this:
Removing our use of pidtree made the errors go away. I believe this is a node bug, but unfortunately I have not yet been successful in creating a minimal reproduction of the issue - everything just works as expected with a small/simple project of only a few modules. Without a simple repro I don't see a lot of point in opening an issue on the core node project.
Anyway, we wanted to continue using pidtree as it is useful so I refactored it to ESM which made the problem go away. I will create a PR in case you wish to consider this for merger, and also thought this issue might be useful to others if they encounter the same issue.
The text was updated successfully, but these errors were encountered: