Skip to content

Commit 291ec1d

Browse files
vaadin-botcaalador
andauthored
fix: sw load should not be system dependent (#21813) (#21818)
Check the load request as relative instead of === to not have a problem between systems that use \ instead of / Fixes #21743 Co-authored-by: caalador <mikael.grankvist@vaadin.com>
1 parent 472825c commit 291ec1d

File tree

1 file changed

+2
-2
lines changed
  • flow-server/src/main/resources/plugins/vite-plugin-service-worker

1 file changed

+2
-2
lines changed

flow-server/src/main/resources/plugins/vite-plugin-service-worker/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference types="node" />
2-
import { resolve } from 'node:path';
2+
import { resolve, relative } from 'node:path';
33
import type { RollupOutput } from 'rollup';
44
import { build, InlineConfig, Plugin } from 'vite';
55
import { getManifest, ManifestTransform } from 'workbox-build';
@@ -97,7 +97,7 @@ export default function serviceWorkerPlugin({ srcPath }: { srcPath: string }): P
9797
return;
9898
},
9999
async load(id) {
100-
if (id === swSourcePath) {
100+
if (relative(id, swSourcePath).length === 0) {
101101
return buildOutput.output[0].code;
102102
}
103103

0 commit comments

Comments
 (0)