Skip to content

Commit

Permalink
Fix distributed types
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeboone02 committed Jan 15, 2024
1 parent 451e44a commit 3da5643
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/numeric-quantity.d.ts",
"import": "./dist/numeric-quantity.mjs",
"require": "./dist/cjs/index.js"
"import": {
"types": "./dist/numeric-quantity.d.mts",
"default": "./dist/numeric-quantity.mjs"
},
"require": {
"types": "./dist/cjs/numeric-quantity.cjs.development.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"types": "./dist/numeric-quantity.d.ts",
"types": "./dist/cjs/numeric-quantity.cjs.production.d.ts",
"unpkg": "./dist/numeric-quantity.umd.min.js",
"bugs": {
"url": "https://github.com/jakeboone02/numeric-quantity/issues"
Expand Down
7 changes: 5 additions & 2 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig(options => {
'numeric-quantity': 'src/index.ts',
},
sourcemap: true,
format: 'esm',
dts: true,
...options,
};

Expand All @@ -21,8 +21,8 @@ export default defineConfig(options => {
// ESM, standard bundler dev, embedded `process` references
{
...commonOptions,
dts: true,
clean: true,
format: 'esm',
},
// ESM, Webpack 4 support. Target ES2017 syntax to compile away optional chaining and spreads
{
Expand All @@ -32,6 +32,7 @@ export default defineConfig(options => {
},
// ESBuild outputs `'.mjs'` by default for the 'esm' format. Force '.js'
outExtension: () => ({ js: '.js' }),
format: 'esm',
target: 'es2017',
},
// ESM for use in browsers. Minified, with `process` compiled away
Expand All @@ -41,6 +42,7 @@ export default defineConfig(options => {
entry: {
'numeric-quantity.production': 'src/index.ts',
},
format: 'esm',
outExtension: () => ({ js: '.mjs' }),
},
// CJS development
Expand Down Expand Up @@ -79,6 +81,7 @@ if (process.env.NODE_ENV === 'production') {
{
...commonOptions,
...productionOptions,
dts: false,
format: 'iife',
globalName: 'NumericQuantity',
outExtension: () => ({ js: '.umd.min.js' }),
Expand Down

0 comments on commit 3da5643

Please sign in to comment.