Skip to content

Commit 64b5841

Browse files
authored
fix: use build base on virtual module (#464)
* fix: use build base on virtual module * chore: include build base tests * chore: include build base tests for virtual
1 parent 912e56e commit 64b5841

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

examples/vanilla-ts-dev-options/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"dev-inline-destroy": "rimraf dev-dist && cross-env DEBUG=vite-plugin-pwa:* SW_DEV=true SW_DESTROY=true SW_INLINE=inline vite --force",
1111
"dev-script-destroy": "rimraf dev-dist && cross-env DEBUG=vite-plugin-pwa:* SW_DEV=true SW_DESTROY=true SW_INLINE=script vite --force",
1212
"build": "cross-env DEBUG=vite-plugin-pwa:* vite build",
13+
"build-auto": "rimraf dev-dist && cross-env DEBUG=vite-plugin-pwa:* SW_DEV=true SW_INLINE=auto vite build --force",
14+
"build-inline": "rimraf dev-dist && cross-env DEBUG=vite-plugin-pwa:* SW_DEV=true SW_INLINE=inline vite build --force",
15+
"build-script": "rimraf dev-dist && cross-env DEBUG=vite-plugin-pwa:* SW_DEV=true SW_INLINE=script vite build --force",
1316
"serve": "serve dist"
1417
},
1518
"devDependencies": {

examples/vanilla-ts-dev-options/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default defineConfig({
1212
VitePWA({
1313
mode: 'development',
1414
base: '/',
15+
/* buildBase: '/test-build-base/', */
1516
includeAssets: ['favicon.svg'],
1617
injectRegister,
1718
selfDestroying,

examples/vanilla-ts-no-ip/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default defineConfig({
1313
VitePWA({
1414
mode: 'development',
1515
base: '/',
16+
/* buildBase: '/test-build-base/', */
1617
strategies: 'injectManifest',
1718
registerType: 'autoUpdate',
1819
includeAssets: ['favicon.svg'],

src/modules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function loadRollupReplacePlugin() {
3939
}
4040

4141
export async function generateRegisterSW(options: ResolvedVitePWAOptions, mode: 'build' | 'dev', source = 'register') {
42-
const sw = options.base + options.filename
42+
const sw = options.buildBase + options.filename
4343
const scope = options.scope
4444

4545
const content = await fs.readFile(resolve(_dirname, `client/${mode}/${source}.mjs`), 'utf-8')

0 commit comments

Comments
 (0)