mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
Build service worker
This commit is contained in:
parent
b39f63ea73
commit
20d3758d38
2 changed files with 17 additions and 0 deletions
|
|
@ -37,6 +37,14 @@ async function build() {
|
||||||
outfile: 'public/bundle/test.js',
|
outfile: 'public/bundle/test.js',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Build service worker
|
||||||
|
await esbuild.build({
|
||||||
|
...prodOptions,
|
||||||
|
entryPoints: ['src/client/sw.ts'],
|
||||||
|
outfile: 'public/sw.js',
|
||||||
|
format: 'iife', // Service workers need IIFE format
|
||||||
|
});
|
||||||
|
|
||||||
console.log('Client bundles built successfully');
|
console.log('Client bundles built successfully');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Build failed:', error);
|
console.error('Build failed:', error);
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,17 @@ async function startBuilding() {
|
||||||
outfile: 'public/bundle/test.js',
|
outfile: 'public/bundle/test.js',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const swContext = await esbuild.context({
|
||||||
|
...devOptions,
|
||||||
|
entryPoints: ['src/client/sw.ts'],
|
||||||
|
outfile: 'public/sw.js',
|
||||||
|
format: 'iife', // Service workers need IIFE format
|
||||||
|
});
|
||||||
|
|
||||||
// Start watching
|
// Start watching
|
||||||
await clientContext.watch();
|
await clientContext.watch();
|
||||||
await testContext.watch();
|
await testContext.watch();
|
||||||
|
await swContext.watch();
|
||||||
console.log('ESBuild watching client bundles...');
|
console.log('ESBuild watching client bundles...');
|
||||||
|
|
||||||
// Start other processes
|
// Start other processes
|
||||||
|
|
@ -67,6 +75,7 @@ async function startBuilding() {
|
||||||
console.log('\nStopping all processes...');
|
console.log('\nStopping all processes...');
|
||||||
await clientContext.dispose();
|
await clientContext.dispose();
|
||||||
await testContext.dispose();
|
await testContext.dispose();
|
||||||
|
await swContext.dispose();
|
||||||
processes.forEach(proc => proc.kill());
|
processes.forEach(proc => proc.kill());
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue