Update TypeScript exports to support moduleResolution bundler #5

Closed
opened 2023-09-02 15:53:05 +02:00 by kwangure · 1 comment
kwangure commented 2023-09-02 15:53:05 +02:00 (Migrated from github.com)

moduleResolution: "bundler" is a recent setting added to TypeScript to support bundler setups. It's the setting you should probably be using when bundling code. With this setting TypeScript only searches for types in the exports field of the package.json.

It requires the following change:

 "exports": {
   "import": "./dist/index.js",
   "require": "./dist/index.cjs",
+  "types": "./dist/index.d.ts"
 },

This is issue is relevent to multiple @lezer packages I'm using.

[`moduleResolution: "bundler"`](https://www.typescriptlang.org/tsconfig#moduleResolution) is a recent setting added to TypeScript to support bundler setups. It's the setting you should probably be using when bundling code. With this setting TypeScript only searches for types in the exports field of the `package.json`. It requires the following change: ```diff "exports": { "import": "./dist/index.js", "require": "./dist/index.cjs", + "types": "./dist/index.d.ts" }, ``` This is issue is relevent to multiple @lezer packages I'm using.
marijnh commented 2023-09-04 18:40:13 +02:00 (Migrated from github.com)

Should be handled by 339111b771

Should be handled by 339111b77182d91d9bce402b5842f88e1cadb1cb
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/cpp#5
No description provided.