Skip to content

Commit 6c12960

Browse files
committed
Add package.json main field for TypeScript plugin
Although the `exports` field should be sufficient, some TypeScript integrations still rely on the `main` field. See #474 (comment)
1 parent 8240ab1 commit 6c12960

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

.changeset/nervous-spiders-sip.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@mdx-js/typescript-plugin': patch
3+
---
4+
5+
Add the main field

.changeset/silly-kiwis-think.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@mdx-js/typescript-plugin': patch
3+
---
4+
5+
Emit type declarations

packages/typescript-plugin/package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@
1313
"author": "Remco Haszing <[email protected]>",
1414
"funding": "https://opencollective.com/unified",
1515
"license": "MIT",
16-
"exports": "./lib/index.cjs",
16+
"main": "./lib/index.cjs",
17+
"exports": {
18+
"types": "./types/index.d.cts",
19+
"default": "./lib/index.cjs"
20+
},
1721
"files": [
18-
"lib"
22+
"lib",
23+
"types"
1924
],
2025
"keywords": [
2126
"IntelliSense",
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
{
22
"extends": "../../tsconfig.base.json",
3+
"include": ["lib"],
34
"references": [{"path": "../language-service/tsconfig.build.json"}],
45
"compilerOptions": {
5-
"noEmit": true,
6+
"declaration": true,
7+
"emitDeclarationOnly": true,
68
// https://github.com/microsoft/TypeScript/issues/57652
7-
"resolveJsonModule": true
9+
"resolveJsonModule": true,
10+
"outDir": "types",
11+
"rootDir": "lib"
812
}
913
}

0 commit comments

Comments
 (0)