Skip to content

Commit 0ea8efa

Browse files
author
Shane Osbourne
committed
post-process with esbuild
1 parent f287659 commit 0ea8efa

File tree

3 files changed

+45
-5
lines changed

3 files changed

+45
-5
lines changed

packages/browser-sync/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
/dist/*
22
/dist_backup/*
3+
/dist2/*
4+
meta1.json
5+
meta2.json

packages/browser-sync/build.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const { writeFileSync } = require("fs");
2+
const out1 = require("esbuild").buildSync({
3+
entryPoints: ["./dist/index.js"],
4+
bundle: true,
5+
platform: "node",
6+
packages: "external",
7+
outfile: "dist2/index.js",
8+
sourcemap: "inline",
9+
metafile: true
10+
});
11+
12+
writeFileSync("meta1.json", JSON.stringify(out1.metafile));
13+
14+
const out2 = require("esbuild").buildSync({
15+
entryPoints: ["./dist/bin.js"],
16+
bundle: true,
17+
platform: "node",
18+
packages: "external",
19+
outfile: "dist2/bin.js",
20+
sourcemap: "inline",
21+
metafile: true
22+
});
23+
24+
writeFileSync("meta2.json", JSON.stringify(out2.metafile));
25+
26+
// require("esbuild").buildSync({
27+
// entryPoints: ["./lodash.custom.js"],
28+
// bundle: true,
29+
// platform: "node",
30+
// format: "esm",
31+
// packages: "external",
32+
// outfile: "lib/underbar.js",
33+
// banner: {
34+
// js: "// @ts-nocheck"
35+
// }
36+
// });

packages/browser-sync/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
},
99
"repository": "BrowserSync/browser-sync",
1010
"license": "Apache-2.0",
11-
"main": "dist/index.js",
12-
"bin": "dist/bin.js",
11+
"main": "dist2/index.js",
12+
"bin": "dist2/bin.js",
1313
"files": [
14-
"dist",
14+
"dist2",
1515
"certs",
1616
"templates",
1717
"cli-options",
@@ -26,8 +26,9 @@
2626
"printWidth": 100
2727
},
2828
"scripts": {
29-
"build": "npm run build:server",
30-
"build:server": "tsc",
29+
"build": "npm run build.tsc && npm run build.esbuild",
30+
"build.tsc": "tsc",
31+
"build.esbuild": "node build.js",
3132
"build:watch": "tsc --watch",
3233
"env": "node ./test/env.js",
3334
"lodash": "lodash include=isUndefined,isFunction,toArray,includes,union,each,isString,merge,isObject,set exports=node",

0 commit comments

Comments
 (0)