Skip to content

Commit

Permalink
Hotfix background (#583)
Browse files Browse the repository at this point in the history
* fix: add slash to url in service worker loader

* tests: update snapshots

* Add changeset
  • Loading branch information
jacksteamdev authored Nov 17, 2022
1 parent 5090492 commit cbce5e1
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-shrimps-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@crxjs/vite-plugin": patch
---

Hotfix background
2 changes: 1 addition & 1 deletion packages/vite-plugin/src/node/plugin-background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const pluginBackground: CrxPluginFn = () => {
throw new Error('server port is undefined in watch mode')

// development, required to define env vars
loader = `import 'http:/localhost:${port}/@vite/env';\n`
loader = `import 'http://localhost:${port}/@vite/env';\n`
// development, required hmr client
loader += `import 'http://localhost:${port}${workerClientId}';\n`
// development, optional service worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ setTimeout(() => clearInterval(id), 5e3);
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
import 'http://localhost:3000/src/background.js';
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ setTimeout(() => clearInterval(id), 5e3);
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
import 'http://localhost:3000/src/background.ts';
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Set {
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
import 'http://localhost:3000/src/background.ts';
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Set {
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Set {
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Set {
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Set {
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Set {
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
import 'http://localhost:3000/src/background.ts';
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Set {
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
import 'http://localhost:3000/src/background.ts';
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ setTimeout(() => clearInterval(id), 5e3);
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Array [
exports[`serve fs output > _02 optimized deps 1`] = `Set {}`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ setTimeout(() => clearInterval(id), 5e3);
`;

exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ exports[`serve fs output > public.js 1`] = `
`;
exports[`serve fs output > service-worker-loader.js 1`] = `
"import 'http:/localhost:3000/@vite/env';
"import 'http://localhost:3000/@vite/env';
import 'http://localhost:3000/@crx/client-worker';
"
`;
Expand Down

0 comments on commit cbce5e1

Please sign in to comment.