Skip to content

Commit 9abd7b2

Browse files
committed
Emit type definitions with cjs format
- Currently there is no difference between emitting type definitions with `cjs` or `esm` format, the only difference is the file extension. So we emit the type definitions with a `cjs` format to preserve the previous `.d.ts` extension as opposed to the new `.d.mts` extension.
1 parent 7e33eee commit 9abd7b2

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"description": "Selectors for Redux.",
55
"main": "./dist/cjs/index.js",
66
"module": "./dist/reselect.legacy-esm.js",
7-
"types": "./dist/reselect.d.mts",
7+
"types": "./dist/reselect.d.ts",
88
"exports": {
99
"./package.json": "./package.json",
1010
".": {
11-
"types": "./dist/reselect.d.mts",
11+
"types": "./dist/reselect.d.ts",
1212
"import": "./dist/reselect.mjs",
1313
"default": "./dist/cjs/index.js"
1414
}

tsup.config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ export default defineConfig((options): Options[] => {
3232
name: 'Modern ESM',
3333
target: ['esnext'],
3434
format: ['esm'],
35-
outExtension: () => ({ js: '.mjs' }),
36-
dts: true
35+
outExtension: () => ({ js: '.mjs' })
3736
},
3837

3938
// Support Webpack 4 by pointing `"module"` to a file with a `.js` extension
@@ -93,6 +92,12 @@ export default defineConfig((options): Options[] => {
9392
onSuccess: async () => {
9493
await writeCommonJSEntry()
9594
}
95+
},
96+
{
97+
...commonOptions,
98+
name: 'Type definitions',
99+
format: ['cjs'],
100+
dts: { only: true }
96101
}
97102
]
98103
})

0 commit comments

Comments
 (0)