Open trusktr opened 8 months ago
Ah, thanks. That's not great, considering that exports
is optional and other packages can import the package fine, so one would think the package should be able to intuitively import itself fine too.
I'd like to avoid having extras that I don't need, like exports
, staying closer to vanilla ESM.
Is it viable to make this a feature request? Or is there a complication with allowing it without exports
?
@nodejs/loaders
exports is only optional because there’s no backwards compatible way to add it by default - every package should have it.
“vanilla ESM” works a similar way in the sense that you choose which files to deploy, and thus which are exposed to the web.
Self-reference uses “exports” paths, so I’m not sure how it’d make sense to have it without exports being present.
I think you should be able to create an exports
field and just expose everything?
"exports": {
".": "./dist/kiwi.js",
"./*": "./*"
}
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the https://github.com/nodejs/node/labels/never-stale label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document.
Version
v20.5.0
Platform
Microsoft Windows NT 10.0.19045.0 x64
Subsystem
npm 10.2.0
What steps will reproduce the bug?
This build shows the problem:
https://github.com/lume/kiwi/actions/runs/6609081452
This commit:
https://github.com/lume/kiwi/commit/45fa46609094b75c95d26252c3899ea3cbcfe048
To reproduce the error:
Output after that will be:
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
Self-referencing imports should work
What do you see instead?
it fails
Additional information
The issue can be temporarily worked around by making a symlink, like so:
After this,
node_modules/@lume/kiwi
will be a link back up to kiwi itself, andnpm run bench
will work.