Skip to content

Commit 92dfc25

Browse files
chore: replace unbuild with tsup for CJS compat
unbuild was not setting both module.exports and module.exports.default which hurts compatibility with CJS. tsup uses esbuild so we'll try it out. Unfortunately arethetypeswrong complains about Missing export = but it's not a breaking error, just unnecessary.
1 parent 5a08aee commit 92dfc25

File tree

6 files changed

+352
-1677
lines changed

6 files changed

+352
-1677
lines changed

build.config.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@
2828
"default": "./dist/index.mjs"
2929
},
3030
"require": {
31-
"types": "./dist/index.d.cts",
32-
"default": "./dist/index.cjs"
31+
"types": "./dist/index.d.ts",
32+
"default": "./dist/index.js"
3333
}
3434
}
3535
},
36-
"main": "./dist/index.cjs",
36+
"main": "./dist/index.js",
3737
"module": "./dist/index.mjs",
3838
"types": "./dist/index.d.ts",
3939
"files": [
4040
"dist",
4141
"docs"
4242
],
4343
"scripts": {
44-
"build": "unbuild && tsx scripts/postbuild.ts",
44+
"build": "tsup",
4545
"lint": "eslint",
4646
"release": "bumpp && yarn run build",
4747
"test": "vitest",
@@ -77,10 +77,10 @@
7777
"eslint-plugin-import-x": "^4.4.0",
7878
"eslint-plugin-n": "^17.12.0",
7979
"rxjs": "^7.0.0",
80+
"tsup": "^8.3.5",
8081
"tsx": "^4.19.2",
8182
"typescript": "~5.6.3",
8283
"typescript-eslint": "^8.12.2",
83-
"unbuild": "^2.0.0",
8484
"vitest": "^2.1.4"
8585
},
8686
"engines": {

scripts/postbuild.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TSESLint } from '@typescript-eslint/utils';
2-
import { name, version } from '../package.json' assert { type: 'json' };
2+
import { name, version } from '../package.json';
33
import { createRecommendedConfig } from './configs/recommended';
44

55
import { banObservablesRule } from './rules/ban-observables';

tsup.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from 'tsup';
2+
3+
export default defineConfig({
4+
entry: [
5+
'src/index.ts',
6+
],
7+
clean: true,
8+
dts: true,
9+
format: ['cjs', 'esm'],
10+
});

0 commit comments

Comments
 (0)