File tree Expand file tree Collapse file tree 4 files changed +45
-44
lines changed Expand file tree Collapse file tree 4 files changed +45
-44
lines changed Original file line number Diff line number Diff line change
1
+ const ESM = await Bun . build ( {
2
+ entrypoints : [ "./src/core/index.ts" , "./src/react/index.tsx" ] ,
3
+ outdir : "./dist/esm" ,
4
+ target : "browser" ,
5
+ format : "esm" ,
6
+ external : [ "react" ] ,
7
+ sourcemap : "linked" ,
8
+ minify : true
9
+ } ) ;
10
+
11
+ const CJS = await Bun . build ( {
12
+ entrypoints : [ "./src/core/index.ts" , "./src/react/index.tsx" ] ,
13
+ outdir : "./dist/cjs" ,
14
+ target : "browser" ,
15
+ format : "cjs" ,
16
+ external : [ "react" ] ,
17
+ sourcemap : "linked" ,
18
+ minify : true
19
+ } ) ;
20
+
21
+ if ( ! ESM . success || ! CJS . success ) {
22
+ console . error ( "Build failed" ) ;
23
+ for ( const message of [ ...ESM . logs , ...CJS . logs ] ) {
24
+ // Bun will pretty print the message object
25
+ console . error ( message ) ;
26
+ }
27
+ }
28
+
29
+ export { }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 38
38
},
39
39
"exports" : {
40
40
"." : {
41
- "require" : " ./dist/core/index.js" ,
42
- "import" : " ./dist/core/index.esm .js" ,
43
- "types" : " ./dist/core /index.d.ts"
41
+ "require" : " ./dist/cjs/ core/index.js" ,
42
+ "import" : " ./dist/esm/ core/index.js" ,
43
+ "types" : " ./dist/types /index.d.ts"
44
44
},
45
45
"./react" : {
46
- "require" : " ./dist/react/index.js" ,
47
- "import" : " ./dist/react/index.esm .js" ,
48
- "types" : " ./dist/react /index.d.ts"
46
+ "require" : " ./dist/cjs/ react/index.js" ,
47
+ "import" : " ./dist/esm/ react/index.js" ,
48
+ "types" : " ./dist/types /index.d.ts"
49
49
}
50
50
},
51
51
"scripts" : {
52
- "test" : " jest" ,
53
- "build" : " tsc"
52
+ "build:library" : " bun ./build.ts" ,
53
+ "build:types" : " bunx tsc" ,
54
+ "build" : " bun build:library && bun build:types && cp -R ./src/types/* ./dist/types"
54
55
},
55
56
"type" : " module" ,
56
57
"types" : " dist/core/index.d.ts"
Original file line number Diff line number Diff line change 1
1
{
2
2
"compilerOptions" : {
3
- "outDir" : " dist" ,
4
- "rootDir " : " src " ,
3
+ "outDir" : " dist/types " ,
4
+ "emitDeclarationOnly " : true ,
5
5
"declaration" : true ,
6
- "declarationDir" : " dist" ,
7
- "emitDeclarationOnly" : false ,
8
- "target" : " ES6" ,
6
+ "target" : " esnext" ,
9
7
"module" : " esnext" ,
10
8
"moduleResolution" : " Bundler" ,
11
9
"strict" : true ,
12
10
"esModuleInterop" : true ,
13
11
"jsx" : " react-jsx" ,
14
12
"sourceMap" : true ,
15
13
"allowJs" : false ,
14
+ "skipLibCheck" : true
16
15
},
17
- "include" : [
18
- " src/core/index.tsx" ,
19
- " src/react/index.tsx" ,
20
- " src/types/index.d.ts" ,
21
- " __tests__/**/*.tsx"
22
- ],
23
- "exclude" : [
24
- " node_modules" ,
25
- " dist" ,
26
- " __tests__"
27
- ],
28
- "types" : [
29
- " node" ,
30
- " jest" ,
31
- " @testing-library/jest-dom" ,
32
- " @testing-library/jest-dom/jest-globals"
33
- ],
34
- "paths" : {
35
- "@/src/*" : [" ./src/*" ],
36
- "simple-shader/core" : [
37
- " src/core/index.ts"
38
- ],
39
- "simple-shader/react" : [
40
- " src/react/index.ts"
41
- ],
42
- // "simple-shader/vue": [
43
- // "src/vue/index.ts"
44
- // ]
45
- }
16
+ "include" : [ " src/**/*" ],
17
+ "exclude" : [ " node_modules" , " dist" ],
18
+ "types" : [ " node" ]
46
19
}
You can’t perform that action at this time.
0 commit comments