File tree Expand file tree Collapse file tree 6 files changed +59
-4
lines changed
Expand file tree Collapse file tree 6 files changed +59
-4
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ package-lock.json
3434
3535! serviceModels /logs
3636dist
37+ tests /bundlers /dist-min
3738
3839.idea /
3940* .iml
@@ -53,7 +54,6 @@ workspace
5354.turbo
5455turbo.dev.json
5556coverage
56- dist
5757dist- *
5858
5959/verdaccio /*
Original file line number Diff line number Diff line change 22
33# asserts that bundles contain expected content.
44test :
5- node test.spec.mjs
5+ node bundlers.spec.mjs
6+ du -sh ./dist-min/*
67
78# create bundles
89build :
10+ rm -rf ./dist/*
11+ rm -rf ./dist-min/*
912 make vite webpack esbuild
1013
14+ # note: vite deletes files in the build folders and must run first.
1115vite :
12- npx vite build
16+ npx vite build --config vite.config.ts
17+ npx vite build --config vite.min.config.ts
1318
1419webpack :
1520 npx webpack
21+ npx webpack -c webpack.min.config.js
1622
1723esbuild :
18- npx esbuild ./source.ts --bundle --outfile=./dist/esbuild-dist.js --format=esm --tree-shaking=true
24+ npx esbuild ./source.ts --bundle --outfile=./dist/esbuild-dist.js --format=esm --tree-shaking=true
25+ npx esbuild ./source.ts --bundle --outfile=./dist-min/esbuild-dist.min.js --format=esm --tree-shaking=true --minify
File renamed without changes.
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import * as path from "node:path";
33
44export default defineConfig ( {
55 build : {
6+ outDir : "./dist" ,
67 lib : {
78 entry : path . join ( __dirname , "source.ts" ) ,
89 name : "dist" ,
Original file line number Diff line number Diff line change 1+ import { defineConfig } from "vite" ;
2+ import * as path from "node:path" ;
3+
4+ export default defineConfig ( {
5+ build : {
6+ outDir : "./dist-min" ,
7+ lib : {
8+ entry : path . join ( __dirname , "source.ts" ) ,
9+ name : "dist-min" ,
10+ // the proper extensions will be added
11+ fileName : "vite-dist.min" ,
12+ } ,
13+ rollupOptions : {
14+ // make sure to externalize deps that shouldn't be bundled
15+ // into your library
16+ external : [ ] ,
17+ output : {
18+ // Provide global variables to use in the UMD build
19+ // for externalized deps
20+ globals : { } ,
21+ // to get an easier aggregate accounting of bundle contents
22+ inlineDynamicImports : true ,
23+ } ,
24+ } ,
25+ minify : true ,
26+ terserOptions : {
27+ mangle : true ,
28+ } ,
29+ } ,
30+ } ) ;
Original file line number Diff line number Diff line change 1+ import path from "node:path" ;
2+ import { fileURLToPath } from "node:url" ;
3+
4+ const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
5+
6+ export default {
7+ mode : "production" ,
8+ entry : "./source.ts" ,
9+ target : "web" ,
10+ output : {
11+ path : path . resolve ( __dirname , "dist-min" ) ,
12+ filename : "webpack-dist.min.js" ,
13+ library : "dist" ,
14+ } ,
15+ optimization : { } ,
16+ stats : { } ,
17+ } ;
You can’t perform that action at this time.
0 commit comments