Skip to content

Commit a4d85ca

Browse files
committed
Fix distributed types
1 parent 686e611 commit a4d85ca

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@
1111
"exports": {
1212
"./package.json": "./package.json",
1313
".": {
14-
"types": "./dist/format-quantity.d.ts",
15-
"import": "./dist/format-quantity.mjs",
16-
"require": "./dist/cjs/index.js"
14+
"import": {
15+
"types": "./dist/format-quantity.d.mts",
16+
"default": "./dist/format-quantity.mjs"
17+
},
18+
"require": {
19+
"types": "./dist/cjs/format-quantity.cjs.development.d.ts",
20+
"default": "./dist/cjs/index.js"
21+
}
1722
}
1823
},
19-
"types": "./dist/format-quantity.d.ts",
24+
"types": "./dist/cjs/format-quantity.cjs.production.d.ts",
2025
"unpkg": "./dist/format-quantity.umd.min.js",
2126
"license": "MIT",
2227
"keywords": [

tsup.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default defineConfig(options => {
88
'format-quantity': 'src/index.ts',
99
},
1010
sourcemap: true,
11-
format: 'esm',
11+
dts: true,
1212
...options,
1313
};
1414

@@ -21,7 +21,7 @@ export default defineConfig(options => {
2121
// ESM, standard bundler dev, embedded `process` references
2222
{
2323
...commonOptions,
24-
dts: true,
24+
format: 'esm',
2525
clean: true,
2626
},
2727
// ESM, Webpack 4 support. Target ES2017 syntax to compile away optional chaining and spreads
@@ -32,6 +32,7 @@ export default defineConfig(options => {
3232
},
3333
// ESBuild outputs `'.mjs'` by default for the 'esm' format. Force '.js'
3434
outExtension: () => ({ js: '.js' }),
35+
format: 'esm',
3536
target: 'es2017',
3637
},
3738
// ESM for use in browsers. Minified, with `process` compiled away
@@ -42,6 +43,7 @@ export default defineConfig(options => {
4243
'format-quantity.production': 'src/index.ts',
4344
},
4445
outExtension: () => ({ js: '.mjs' }),
46+
format: 'esm',
4547
},
4648
// CJS development
4749
{
@@ -79,6 +81,7 @@ if (process.env.NODE_ENV === 'production') {
7981
{
8082
...commonOptions,
8183
...productionOptions,
84+
dts: false,
8285
format: 'iife',
8386
globalName: 'FormatQuantity',
8487
outExtension: () => ({ js: '.umd.min.js' }),

0 commit comments

Comments
 (0)