Skip to content

Commit d9d6d98

Browse files
committed
Support --profile in build script
1 parent 1250f00 commit d9d6d98

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/build.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const prodOptions = {
3636
async function main(args) {
3737
let isProd = false;
3838
let shouldWatch = false;
39+
let shouldProfile = false;
3940

4041
for (const arg of args) {
4142
switch (arg) {
@@ -45,6 +46,9 @@ async function main(args) {
4546
case '--watch':
4647
shouldWatch = true;
4748
break;
49+
case '--profile':
50+
shouldProfile = true;
51+
break;
4852
default:
4953
throw new Error(`Unknown arg: ${arg}`);
5054
}
@@ -53,6 +57,9 @@ async function main(args) {
5357
/** @type {esbuild.BuildOptions} */
5458
const buildOptions = {
5559
...(isProd ? prodOptions : devOptions),
60+
...(shouldProfile
61+
? { banner: { js: '#!/usr/bin/env node --cpu-prof' } }
62+
: {}),
5663
};
5764

5865
console.log('Building with options:', buildOptions);

0 commit comments

Comments
 (0)