File tree Expand file tree Collapse file tree 4 files changed +44
-21
lines changed Expand file tree Collapse file tree 4 files changed +44
-21
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import { createRequire } from 'node:module'
2
+ import path from 'node:path'
3
+ import url from 'node:url'
4
+
5
+ globalThis . require = createRequire ( import . meta. url )
6
+ globalThis . __filename = url . fileURLToPath ( import . meta. url )
7
+ globalThis . __dirname = path . dirname ( __filename )
Original file line number Diff line number Diff line change 43
43
"node" : " >=v14.21.3"
44
44
},
45
45
"scripts" : {
46
- "build" : " unbuild " ,
47
- "stub" : " unbuild --stub "
46
+ "build" : " tsup " ,
47
+ "stub" : " tsup --watch "
48
48
},
49
49
"peerDependencies" : {
50
50
"vite" : " ^3.1.0 || ^4.0.0-0 || ^5.0.0-0"
Original file line number Diff line number Diff line change
1
+ import { defineConfig } from 'tsup'
2
+
3
+ export default defineConfig ( {
4
+ entryPoints : [
5
+ 'src/vite.ts' ,
6
+ ] ,
7
+ // To avoid esbuild compile import.meta.url to import_meta.url
8
+ // See: https://github.com/vitejs/vite/issues/503
9
+ target : 'es2020' ,
10
+ clean : true ,
11
+ format : [ 'esm' , 'cjs' ] ,
12
+ // Force esbuild to use .mjs extension for ESM output
13
+ outExtension ( { format } ) {
14
+ if ( format === 'esm' ) {
15
+ return {
16
+ js : '.mjs' ,
17
+ dts : '.d.ts' ,
18
+ }
19
+ }
20
+ else if ( format === 'cjs' ) {
21
+ return {
22
+ js : '.cjs' ,
23
+ dts : '.d.cts' ,
24
+ }
25
+ }
26
+ return {
27
+ js : '.js' ,
28
+ dts : '.d.ts' ,
29
+ }
30
+ } ,
31
+ // See: https://github.com/evanw/esbuild/issues/1921
32
+ inject : [ './esbuild-shims/cjs-shim.ts' ] ,
33
+ dts : true ,
34
+ shims : true ,
35
+ } )
You can’t perform that action at this time.
0 commit comments