File tree Expand file tree Collapse file tree 3 files changed +257
-7
lines changed Expand file tree Collapse file tree 3 files changed +257
-7
lines changed Original file line number Diff line number Diff line change 8
8
"@changesets/changelog-github" : " ^0.5.1" ,
9
9
"@changesets/cli" : " ^2.29.3" ,
10
10
"@changesets/write" : " ^0.4.0" ,
11
+ "@rollup/plugin-commonjs" : " ^28.0.3" ,
12
+ "@rollup/plugin-json" : " ^6.1.0" ,
13
+ "@rollup/plugin-node-resolve" : " ^16.0.1" ,
14
+ "@rollup/plugin-terser" : " ^0.4.4" ,
11
15
"@types/node" : " ^22.15.17" ,
12
16
"@types/semver" : " ^7.5.0" ,
17
+ "builtin-modules" : " ^5.0.0" ,
13
18
"esbuild" : " ^0.25.4" ,
14
19
"fixturez" : " ^1.1.0" ,
15
20
"husky" : " ^3.0.3" ,
16
21
"prettier" : " ^2.0.5" ,
22
+ "rollup" : " ^4.40.2" ,
17
23
"typescript" : " ^5.8.3" ,
18
24
"vitest" : " ^3.1.3"
19
25
},
20
26
"scripts" : {
21
- "build" : " esbuild src/index.ts --bundle --platform=node --target=node20 --format=esm --minify --outfile=dist/index.js " ,
27
+ "build" : " rollup -c " ,
22
28
"test" : " vitest" ,
23
29
"test:watch" : " yarn test --watch" ,
24
30
"typecheck" : " tsc" ,
Original file line number Diff line number Diff line change
1
+ import { defineConfig } from "rollup" ;
2
+ import commonjs from "@rollup/plugin-commonjs" ;
3
+ import nodeResolve from "@rollup/plugin-node-resolve" ;
4
+ import terser from "@rollup/plugin-terser" ;
5
+ import json from "@rollup/plugin-json" ;
6
+ import { transform } from "esbuild" ;
7
+ import builtinModulesList from "builtin-modules" ;
8
+
9
+ const builtinModules = new Set ( builtinModulesList ) ;
10
+
11
+ export default defineConfig ( {
12
+ input : "src/index.ts" ,
13
+ output : {
14
+ dir : "dist" ,
15
+ format : "esm" ,
16
+ } ,
17
+ external : ( id ) => builtinModules . has ( id ) ,
18
+ plugins : [
19
+ nodeResolve ( {
20
+ preferBuiltins : false ,
21
+ } ) ,
22
+ json ( ) ,
23
+ commonjs ( ) ,
24
+ {
25
+ name : "esbuild" ,
26
+ async transform ( code , id ) {
27
+ if ( ! / \. ( m t s | c t s | t s | t s x ) $ / . test ( id ) ) {
28
+ return null ;
29
+ }
30
+ const result = await transform ( code , {
31
+ loader : "ts" ,
32
+ } ) ;
33
+ return result . code ;
34
+ } ,
35
+ } ,
36
+ terser ( ) ,
37
+ ] ,
38
+ } ) ;
You can’t perform that action at this time.
0 commit comments