File tree Expand file tree Collapse file tree 3 files changed +38
-27
lines changed
Filter options
Expand file tree Collapse file tree 3 files changed +38
-27
lines changed
Original file line number Diff line number Diff line change 27
27
],
28
28
"sideEffects" : false ,
29
29
"exports" : {
30
- "production" : {
31
- "require" : " ./dist/prod/index.js" ,
32
- "import" : " ./dist/prod/index.mjs"
33
- },
34
- "require" : " ./dist/index.js" ,
35
- "import" : " ./dist/index.mjs" ,
36
- "default" : " ./dist/index.mjs"
30
+ "." : {
31
+ "production" : {
32
+ "require" : " ./dist/prod/index.cjs" ,
33
+ "import" : " ./dist/prod/index.mjs"
34
+ },
35
+ "require" : " ./dist/index.cjs" ,
36
+ "import" : " ./dist/index.mjs" ,
37
+ "types" : " ./index.d.ts"
38
+ }
37
39
},
38
- "main" : " dist/index.js " ,
40
+ "main" : " dist/index.cjs " ,
39
41
"module" : " dist/index.mjs" ,
40
42
"unpkg" : " dist/prod/index.global.js" ,
41
43
"jsdelivr" : " dist/prod/index.global.js" ,
49
51
"node" : " >=12.0.0"
50
52
},
51
53
"scripts" : {
52
- "build" : " tsup" ,
54
+ "build" : " rimraf dist && tsup" ,
53
55
"lint" : " eslint ." ,
54
56
"ls-lint" : " ls-lint" ,
55
57
"typecheck" : " tsc --noEmit -p tsconfig.json" ,
91
93
"husky" : " ^8.0.1" ,
92
94
"lint-staged" : " ^13.0.3" ,
93
95
"release-it" : " *" ,
96
+ "rimraf" : " ^3.0.2" ,
94
97
"tsup" : " ^6.2.3" ,
95
98
"typescript" : " ^4.8.4" ,
96
99
"vite" : " ^3.1.4" ,
Original file line number Diff line number Diff line change 1
1
import { defineConfig } from 'tsup'
2
2
import GlobalsPlugin from 'esbuild-plugin-globals'
3
3
4
- export default defineConfig ( [ {
4
+ const common = defineConfig ( {
5
5
entry : [ 'src/index.ts' , 'src/composition.ts' ] ,
6
6
format : [ 'esm' , 'cjs' , 'iife' ] ,
7
+ target : 'node12' ,
8
+ outExtension : ( { format } ) => {
9
+ if ( format === 'iife' )
10
+ return { js : '.global.js' }
11
+
12
+ if ( format === 'cjs' )
13
+ return { js : '.cjs' }
14
+
15
+ if ( format === 'esm' )
16
+ return { js : '.mjs' }
17
+
18
+ return { js : '.js' }
19
+ } ,
7
20
globalName : 'FluentVue' ,
8
- outDir : 'dist/' ,
9
- dts : true ,
10
21
splitting : true ,
11
- clean : true ,
12
- env : {
13
- NODE_ENV : 'development' ,
14
- } ,
15
22
esbuildPlugins : [
16
23
GlobalsPlugin ( {
17
24
'vue-demi' : 'VueDemi' ,
18
25
'@fluent/bundle' : 'FluentBundle' ,
19
26
} ) ,
20
27
] ,
21
28
external : [ 'vue-demi' , '@fluent/bundle' ] ,
29
+ } )
30
+
31
+ export default defineConfig ( [ {
32
+ ...common ,
33
+ outDir : 'dist/' ,
34
+ dts : true ,
35
+ env : {
36
+ NODE_ENV : 'development' ,
37
+ } ,
22
38
} ,
23
39
{
24
- entry : [ 'src/index.ts' , 'src/composition.ts' ] ,
25
- format : [ 'esm' , 'cjs' , 'iife' ] ,
26
- globalName : 'FluentVue' ,
40
+ ...common ,
27
41
outDir : 'dist/prod' ,
28
- splitting : true ,
29
42
env : {
30
43
NODE_ENV : 'production' ,
31
44
} ,
32
45
minify : true ,
33
- esbuildPlugins : [
34
- GlobalsPlugin ( {
35
- 'vue-demi' : 'VueDemi' ,
36
- '@fluent/bundle' : 'FluentBundle' ,
37
- } ) ,
38
- ] ,
39
- external : [ 'vue-demi' , '@fluent/bundle' ] ,
40
46
} ] )
You can’t perform that action at this time.
0 commit comments