package: update esbuild to 0.17.2
This commit is contained in:
parent
c1b8fe8182
commit
02aa0c1282
3 changed files with 150 additions and 135 deletions
|
@ -18,7 +18,6 @@ const nodeDefaults = {
|
|||
// See: https://github.com/evanw/esbuild/issues/1147
|
||||
keepNames: true,
|
||||
logLevel: 'info',
|
||||
watch,
|
||||
};
|
||||
|
||||
const bundleDefaults = {
|
||||
|
@ -62,24 +61,40 @@ const bundleDefaults = {
|
|||
],
|
||||
};
|
||||
|
||||
// App, tests, and scripts
|
||||
esbuild.build({
|
||||
...nodeDefaults,
|
||||
format: 'cjs',
|
||||
mainFields: ['browser', 'main'],
|
||||
entryPoints: glob
|
||||
.sync('{app,ts,sticker-creator}/**/*.{ts,tsx}', {
|
||||
nodir: true,
|
||||
root: ROOT_DIR,
|
||||
})
|
||||
.filter(file => !file.endsWith('.d.ts')),
|
||||
outdir: path.join(ROOT_DIR),
|
||||
});
|
||||
async function main() {
|
||||
// App, tests, and scripts
|
||||
const app = await esbuild.context({
|
||||
...nodeDefaults,
|
||||
format: 'cjs',
|
||||
mainFields: ['browser', 'main'],
|
||||
entryPoints: glob
|
||||
.sync('{app,ts,sticker-creator}/**/*.{ts,tsx}', {
|
||||
nodir: true,
|
||||
root: ROOT_DIR,
|
||||
})
|
||||
.filter(file => !file.endsWith('.d.ts')),
|
||||
outdir: path.join(ROOT_DIR),
|
||||
});
|
||||
|
||||
// Preload bundle
|
||||
esbuild.build({
|
||||
...bundleDefaults,
|
||||
mainFields: ['browser', 'main'],
|
||||
entryPoints: [path.join(ROOT_DIR, 'ts', 'windows', 'main', 'preload.ts')],
|
||||
outfile: path.join(ROOT_DIR, 'preload.bundle.js'),
|
||||
// Preload bundle
|
||||
const bundle = await esbuild.context({
|
||||
...bundleDefaults,
|
||||
mainFields: ['browser', 'main'],
|
||||
entryPoints: [path.join(ROOT_DIR, 'ts', 'windows', 'main', 'preload.ts')],
|
||||
outfile: path.join(ROOT_DIR, 'preload.bundle.js'),
|
||||
});
|
||||
|
||||
if (watch) {
|
||||
await Promise.all([app.watch(), bundle.watch()]);
|
||||
} else {
|
||||
await Promise.all([app.rebuild(), bundle.rebuild()]);
|
||||
}
|
||||
|
||||
await app.dispose();
|
||||
await bundle.dispose();
|
||||
}
|
||||
|
||||
main().catch(error => {
|
||||
console.error(error.stack);
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue