Skip to content

Commit 35858b1

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 2cc0eef commit 35858b1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: tsup.config.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export default defineConfig((options): Options[] => {
3636
name: 'Modern ESM',
3737
format: ['esm'],
3838
outExtension: () => ({ js: '.mjs' }),
39-
dts: true,
4039
},
4140
{
4241
...commonOptions,
@@ -71,7 +70,7 @@ export default defineConfig((options): Options[] => {
7170
},
7271
platform: 'browser',
7372
env: {
74-
NODE_ENV: 'production'
73+
NODE_ENV: 'production',
7574
},
7675
format: ['esm'],
7776
outExtension: () => ({ js: '.mjs' }),
@@ -84,7 +83,7 @@ export default defineConfig((options): Options[] => {
8483
'react-redux.development': 'src/index.ts',
8584
},
8685
env: {
87-
NODE_ENV: 'development'
86+
NODE_ENV: 'development',
8887
},
8988
format: ['cjs'],
9089
outDir: './dist/cjs/',
@@ -97,7 +96,7 @@ export default defineConfig((options): Options[] => {
9796
'react-redux.production.min': 'src/index.ts',
9897
},
9998
env: {
100-
NODE_ENV: 'production'
99+
NODE_ENV: 'production',
101100
},
102101
format: ['cjs'],
103102
outDir: './dist/cjs/',
@@ -107,5 +106,11 @@ export default defineConfig((options): Options[] => {
107106
await writeCommonJSEntry()
108107
},
109108
},
109+
{
110+
...commonOptions,
111+
name: 'CJS Type definitions',
112+
format: ['cjs'],
113+
dts: { only: true },
114+
},
110115
]
111116
})

0 commit comments

Comments
 (0)