File tree Expand file tree Collapse file tree 2 files changed +9
-19
lines changed Expand file tree Collapse file tree 2 files changed +9
-19
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- import { defineConfig , type Options } from "tsup" ;
1
+ import { defineConfig } from "tsup" ;
2
2
3
- const defaultConfig : Options = {
3
+ export default defineConfig ( {
4
4
entryPoints : [ "src/main.ts" ] ,
5
5
outDir : "dist" ,
6
+ format : [ "esm" , "cjs" ] ,
6
7
tsconfig : "./tsconfig.json" ,
7
8
target : "es2022" ,
8
9
minify : false ,
@@ -11,16 +12,10 @@ const defaultConfig: Options = {
11
12
minifyIdentifiers : true ,
12
13
clean : true ,
13
14
dts : true ,
14
- } ;
15
-
16
- export default defineConfig ( [
17
- {
18
- ...defaultConfig ,
19
- format : [ "esm" ] ,
20
- inject : [ 'tsup-require-shim.ts' ]
15
+ banner ( { format } ) {
16
+ if ( format === "esm" ) {
17
+ return { js : `import { createRequire as __tinyexec_cr } from "node:module";const require = __tinyexec_cr(import.meta.url);` } ;
18
+ }
21
19
} ,
22
- {
23
- ...defaultConfig ,
24
- format : [ "cjs" ]
25
- }
26
- ] ) ;
20
+ } ) ;
21
+
You can’t perform that action at this time.
0 commit comments