File tree Expand file tree Collapse file tree 4 files changed +50
-13
lines changed Expand file tree Collapse file tree 4 files changed +50
-13
lines changed Original file line number Diff line number Diff line change 39
39
- uses : ./.github/actions/setup-test-env
40
40
- name : Check dependency versions
41
41
run : pnpm check-dependency-versions
42
+ bundle-sizes :
43
+ runs-on : ubuntu-latest
44
+ steps :
45
+ - uses : actions/checkout@v3
46
+ - uses : ./.github/actions/setup-test-env
47
+ - name : Build all packages (so they can require each other)
48
+ run : pnpm build
49
+ - name : Build test bundles
50
+ run : pnpm -F=test-bundles test-build
51
+ - name : Send bundle stats to RelativeCI
52
+ uses : relative-ci/agent-action@v2
53
+ with :
54
+ webpackStatsFile : ./packages/test-bundles/dist/react-read-webpack-stats.json
55
+ key : ${{ secrets.RELATIVE_CI_KEY }}
56
+ token : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1
1
import react from "@vitejs/plugin-react-swc" ;
2
+ import { webpackStats } from "rollup-plugin-webpack-stats" ;
3
+
2
4
import fs from "fs" ;
3
5
import { join , parse } from "path" ;
4
6
import { visualizer } from "rollup-plugin-visualizer" ;
@@ -7,20 +9,27 @@ import { build } from "vite";
7
9
8
10
const bundleDir = fileURLToPath ( new URL ( "bundles" , import . meta. url ) ) ;
9
11
const entrypoints = fs . readdirSync ( bundleDir ) ;
10
-
12
+ console . log ( entrypoints ) ;
11
13
for ( const entrypoint of entrypoints ) {
12
14
const parsed = parse ( entrypoint ) ;
13
15
const name = parsed . name ;
14
16
15
- const visualizerPlugin = visualizer ( {
16
- emitFile : true ,
17
- filename : `${ name } -stats.html` ,
18
- template : "treemap" ,
19
- brotliSize : true ,
20
- gzipSize : true ,
21
- } ) as any ;
17
+ const plugins = [
18
+ // Output webpack-stats.json file
19
+ webpackStats ( { fileName : `${ name } -webpack-stats.json` } ) ,
20
+ // Output visualized bundle stats for developers
21
+ visualizer ( {
22
+ emitFile : true ,
23
+ filename : `${ name } -stats.html` ,
24
+ template : "treemap" ,
25
+ brotliSize : true ,
26
+ gzipSize : true ,
27
+ } ) as any ,
28
+ ] ;
22
29
23
- const plugins = parsed . ext . endsWith ( "x" ) ? [ react ( ) , visualizerPlugin ] : [ visualizerPlugin ] ;
30
+ if ( parsed . ext . endsWith ( "x" ) ) {
31
+ plugins . push ( react ( ) ) ;
32
+ }
24
33
25
34
await build ( {
26
35
plugins,
Original file line number Diff line number Diff line change 19
19
"vite" : " ^4.4.7"
20
20
},
21
21
"devDependencies" : {
22
- "rollup-plugin-visualizer" : " ^5.9.2"
22
+ "rollup-plugin-visualizer" : " ^5.9.2" ,
23
+ "rollup-plugin-webpack-stats" : " ^0.2.1"
23
24
}
24
25
}
You can’t perform that action at this time.
0 commit comments