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 88 "@changesets/changelog-github" : " ^0.5.1" ,
99 "@changesets/cli" : " ^2.29.3" ,
1010 "@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" ,
1115 "@types/node" : " ^22.15.17" ,
1216 "@types/semver" : " ^7.5.0" ,
17+ "builtin-modules" : " ^5.0.0" ,
1318 "esbuild" : " ^0.25.4" ,
1419 "fixturez" : " ^1.1.0" ,
1520 "husky" : " ^3.0.3" ,
1621 "prettier" : " ^2.0.5" ,
22+ "rollup" : " ^4.40.2" ,
1723 "typescript" : " ^5.8.3" ,
1824 "vitest" : " ^3.1.3"
1925 },
2026 "scripts" : {
21- "build" : " esbuild src/index.ts --bundle --platform=node --target=node20 --format=esm --minify --outfile=dist/index.js " ,
27+ "build" : " rollup -c " ,
2228 "test" : " vitest" ,
2329 "test:watch" : " yarn test --watch" ,
2430 "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