Version
v22.9.0
Platform
Darwin Mac-mini.local 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:36:26 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T8103 arm64
Subsystem
No response
What steps will reproduce the bug?
related repo https://github.com/Callidon/bloom-filters
When I added this bloom-filters CJS package to my ESM project, I could not import the named functions of this package by name, and could only use the default import.
steps for reproduction:
- this is reproduction code: bloom-filters.zip
- Enter the
demo_test directory and execute yarn to install dependencies. At this time, bloom-filters is pulled in by npm.
- When you run
node index.js, you'll notice that all the named functions exported by the package are located on the default object except for the MinHash method.
- Now, let's import the bloom-filter as a file protocol.
-
Then run node index.js

-
As shown in the figure above, all named functions in bloom-filter have appeared on the module object and default object.
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
My expectation is that the bloom-filter pulled from npm can also import named functions.
Just like what is said in the document https://nodejs.org/docs/latest-v22.x/api/esm.html#commonjs-namespaces
What do you see instead?
As I have described.
Additional information
No response
Version
v22.9.0
Platform
Subsystem
No response
What steps will reproduce the bug?
related repo https://github.com/Callidon/bloom-filters
When I added this bloom-filters CJS package to my ESM project, I could not import the named functions of this package by name, and could only use the default import.
steps for reproduction:
demo_testdirectory and executeyarnto install dependencies. At this time,bloom-filtersis pulled in bynpm.node index.js, you'll notice that all the named functions exported by the package are located on the default object except for the MinHash method.Then run

node index.jsAs shown in the figure above, all named functions in
bloom-filterhave appeared on the module object and default object.How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
My expectation is that the
bloom-filterpulled from npm can also import named functions.Just like what is said in the document https://nodejs.org/docs/latest-v22.x/api/esm.html#commonjs-namespaces
What do you see instead?
As I have described.
Additional information
No response