Skip to content

Commit

Permalink
fix: use build base on virtual module (#464)
Browse files Browse the repository at this point in the history
* fix: use build base on virtual module

* chore: include build base tests

* chore: include build base tests for virtual
  • Loading branch information
userquin committed Feb 10, 2023
1 parent 912e56e commit 64b5841
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/vanilla-ts-dev-options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"dev-inline-destroy": "rimraf dev-dist && cross-env DEBUG=vite-plugin-pwa:* SW_DEV=true SW_DESTROY=true SW_INLINE=inline vite --force",
"dev-script-destroy": "rimraf dev-dist && cross-env DEBUG=vite-plugin-pwa:* SW_DEV=true SW_DESTROY=true SW_INLINE=script vite --force",
"build": "cross-env DEBUG=vite-plugin-pwa:* vite build",
"build-auto": "rimraf dev-dist && cross-env DEBUG=vite-plugin-pwa:* SW_DEV=true SW_INLINE=auto vite build --force",
"build-inline": "rimraf dev-dist && cross-env DEBUG=vite-plugin-pwa:* SW_DEV=true SW_INLINE=inline vite build --force",
"build-script": "rimraf dev-dist && cross-env DEBUG=vite-plugin-pwa:* SW_DEV=true SW_INLINE=script vite build --force",
"serve": "serve dist"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/vanilla-ts-dev-options/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default defineConfig({
VitePWA({
mode: 'development',
base: '/',
/* buildBase: '/test-build-base/', */
includeAssets: ['favicon.svg'],
injectRegister,
selfDestroying,
Expand Down
1 change: 1 addition & 0 deletions examples/vanilla-ts-no-ip/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default defineConfig({
VitePWA({
mode: 'development',
base: '/',
/* buildBase: '/test-build-base/', */
strategies: 'injectManifest',
registerType: 'autoUpdate',
includeAssets: ['favicon.svg'],
Expand Down
2 changes: 1 addition & 1 deletion src/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function loadRollupReplacePlugin() {
}

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

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

0 comments on commit 64b5841

Please sign in to comment.