chore(build): fix bug where sw changes aren't copied in watch mode (#33579)
This commit is contained in:
parent
5e8b469c1c
commit
3fa33ca81f
|
@ -291,6 +291,25 @@ steps.push({
|
||||||
concurrent: watchMode, // feeds into trace-viewer's `public` directory, so it needs to be finished before trace-viewer build starts
|
concurrent: watchMode, // feeds into trace-viewer's `public` directory, so it needs to be finished before trace-viewer build starts
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (watchMode) {
|
||||||
|
// the build above outputs into `packages/trace-viewer/public`, where the `vite build` for `packages/trace-viewer` is supposed to pick it up.
|
||||||
|
// there's a bug in `vite build --watch` though where the public dir is only copied over initially, but its not watched.
|
||||||
|
// to work around this, we run a second watch build of the service worker into the final output.
|
||||||
|
// bug: https://github.com/vitejs/vite/issues/18655
|
||||||
|
steps.push({
|
||||||
|
command: 'npx',
|
||||||
|
args: [
|
||||||
|
'vite', '--config', 'vite.sw.config.ts',
|
||||||
|
'build', '--watch', '--minify=false',
|
||||||
|
'--outDir', path.join(__dirname, '..', '..', 'packages', 'playwright-core', 'lib', 'vite', 'trace-viewer'),
|
||||||
|
'--emptyOutDir=false'
|
||||||
|
],
|
||||||
|
shell: true,
|
||||||
|
cwd: path.join(__dirname, '..', '..', 'packages', 'trace-viewer'),
|
||||||
|
concurrent: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Build/watch web packages.
|
// Build/watch web packages.
|
||||||
for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {
|
for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {
|
||||||
steps.push({
|
steps.push({
|
||||||
|
|
Loading…
Reference in New Issue