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
{{ message }}
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
I am using "exports" in new project's package.json that I run in Node.js v13.2+ and it works great.
(Note, specifically Node v13.2+ because 13.2 introduced a feature where mapping a folder in exports causes it to behave exactly like the desired functionality of mainDir that is expressed in nodejs/node#14970).
In particular the feature that I'm wondering about is, if a path is mapped to another path using exports, then the consumer of the package can import anything from that mapped folder and subfolders. Prior to Node 13.2 mapping a folder would cause any of its sub-folders to be unavailable for import.
For example, my exports field is like this normally:
// causes Node to load the-package/dist/Foo.js:import{Foo}from'the-package/Foo.js'// causes Node to load the-package/dist/index.js:import{blah}from'the-package'
Does esm support this same functionality? I'm looking for something to fallback to until Electron is released with Node 14. They are on Node 12 right now, and only ship with LTS Node.
The text was updated successfully, but these errors were encountered:
@trusktr are you using named imports in production with node 13 today? I'm asking because most of libs do not provide exports (i.e: lodash-es) thus named import do not work with them, and this is preventing me from upgrading to v13+esm. Did you manage to work it around?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am using
"exports"
in new project's package.json that I run in Node.js v13.2+ and it works great.(Note, specifically Node v13.2+ because 13.2 introduced a feature where mapping a folder in
exports
causes it to behave exactly like the desired functionality ofmainDir
that is expressed in nodejs/node#14970).In particular the feature that I'm wondering about is, if a path is mapped to another path using
exports
, then the consumer of the package can import anything from that mapped folder and subfolders. Prior to Node 13.2 mapping a folder would cause any of its sub-folders to be unavailable for import.For example, my exports field is like this normally:
And this means a user can:
Does
esm
support this same functionality? I'm looking for something to fallback to until Electron is released with Node 14. They are on Node 12 right now, and only ship with LTS Node.The text was updated successfully, but these errors were encountered: