We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exports
package.json
typescript package.json exports field package resolution
The version 13.2 of Node.js allows ESM modules and a new package.json field, called exports, to select and rewrite exported files.
However, TypeScript doesn't take it into account.
For example, I have a library with a dist folder. And I only want to export this folder.
dist
Currently, I have to add a bunch of files at the root of the package to include those in the dist folder.
I add:
exports: { "./": "./dist/" }
to my package.json and want to be able to import my scripts with:
import myscript from "mylibrary/myscript";
instead of:
import myscript from "mylibrary/dist/myscript";
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered:
This is a duplicate of #33079
Sorry, something went wrong.
No branches or pull requests
Search Terms
typescript
package.json
exports field
package resolution
Suggestion
The version 13.2 of Node.js allows ESM modules and a new
package.json
field, calledexports
, to select and rewrite exported files.However, TypeScript doesn't take it into account.
Use Cases
For example, I have a library with a
dist
folder. And I only want to export this folder.Currently, I have to add a bunch of files at the root of the package to include those in the
dist
folder.Examples
I add:
to my package.json and want to be able to import my scripts with:
instead of:
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: