Skip to content

Commit 39a1ae4

Browse files
committed
playing with cjs exports
1 parent 2762cef commit 39a1ae4

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

packages/abi-ts/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
"license": "MIT",
1111
"type": "module",
1212
"exports": {
13-
"./internal": "./dist/exports/internal.js"
13+
"./internal": {
14+
"import": "./dist/exports/internal.js",
15+
"default": "./dist/exports/internal.cjs"
16+
}
1417
},
1518
"typesVersions": {
1619
"*": {
@@ -20,7 +23,7 @@
2023
}
2124
},
2225
"bin": {
23-
"abi-ts": "./bin/abi-ts.js"
26+
"abi-ts": "./bin/abi-ts.cjs"
2427
},
2528
"files": [
2629
"bin",

packages/abi-ts/tsup.config.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
import { defineConfig } from "tsup";
2+
import { baseConfig } from "../../tsup.config.base";
23

34
export default defineConfig((opts) => ({
5+
...baseConfig(opts),
46
entry: ["src/exports/internal.ts", "src/bin/abi-ts.ts"],
5-
target: "esnext",
6-
format: ["esm"],
7-
sourcemap: true,
8-
minify: true,
9-
// don't generate DTS during watch mode because it's slow
10-
// we're likely using TS source in this mode anyway
11-
dts: !opts.watch,
12-
// don't clean during watch mode to avoid removing
13-
// previously-built DTS files, which other build tasks
14-
// depend on
15-
clean: !opts.watch,
167
}));

tsup.config.base.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Options } from "tsup";
2+
3+
export function baseConfig(opts: Options): Options {
4+
return {
5+
target: "esnext",
6+
format: ["esm", "cjs"],
7+
minify: true,
8+
sourcemap: true,
9+
// don't generate DTS during watch mode because it's slow
10+
// we're likely using TS source in this mode anyway
11+
dts: !opts.watch,
12+
// don't clean during watch mode to avoid removing
13+
// previously-built DTS files, which other build tasks
14+
// depend on
15+
clean: !opts.watch,
16+
};
17+
}

0 commit comments

Comments
 (0)