From 40f310acaad3d9db020d4a607386b4c64e2fa549 Mon Sep 17 00:00:00 2001 From: Caio Ferrarezi Date: Tue, 24 May 2022 14:55:17 -0300 Subject: [PATCH 1/3] fix: add base config option to partytown snippet generation --- packages/integrations/partytown/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/integrations/partytown/src/index.ts b/packages/integrations/partytown/src/index.ts index 425a0bc76636..45d91f84f4a0 100644 --- a/packages/integrations/partytown/src/index.ts +++ b/packages/integrations/partytown/src/index.ts @@ -25,9 +25,10 @@ export default function createPlugin(options: PartytownOptions): AstroIntegratio name: '@astrojs/partytown', hooks: { 'astro:config:setup': ({ config: _config, command, injectScript }) => { + const lib = path.join(_config.base || '/', '~partytown'); const forward = options?.config?.forward || []; const debug = options?.config?.debug || command === 'dev'; - partytownSnippetHtml = partytownSnippet({ debug, forward }); + partytownSnippetHtml = partytownSnippet({ lib, debug, forward }); injectScript('head-inline', partytownSnippetHtml); }, 'astro:config:done': ({ config: _config }) => { From b6d6a7abcc622f24ced33d79328b4b2be371a525 Mon Sep 17 00:00:00 2001 From: Caio Ferrarezi Date: Tue, 24 May 2022 15:09:54 -0300 Subject: [PATCH 2/3] add changeset --- .changeset/orange-colts-march.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/orange-colts-march.md diff --git a/.changeset/orange-colts-march.md b/.changeset/orange-colts-march.md new file mode 100644 index 000000000000..825130de2428 --- /dev/null +++ b/.changeset/orange-colts-march.md @@ -0,0 +1,5 @@ +--- +'@astrojs/partytown': patch +--- + +Fix partytown script generation to get astro base config option From f737e4caca7183c87638f79d5c751c672f8e3a41 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Tue, 24 May 2022 14:37:56 -0500 Subject: [PATCH 3/3] fix: handle config.base for partytown --- packages/integrations/partytown/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/integrations/partytown/src/index.ts b/packages/integrations/partytown/src/index.ts index 45d91f84f4a0..789f974eb526 100644 --- a/packages/integrations/partytown/src/index.ts +++ b/packages/integrations/partytown/src/index.ts @@ -25,7 +25,7 @@ export default function createPlugin(options: PartytownOptions): AstroIntegratio name: '@astrojs/partytown', hooks: { 'astro:config:setup': ({ config: _config, command, injectScript }) => { - const lib = path.join(_config.base || '/', '~partytown'); + const lib = `${_config.base}~partytown/`; const forward = options?.config?.forward || []; const debug = options?.config?.debug || command === 'dev'; partytownSnippetHtml = partytownSnippet({ lib, debug, forward }); @@ -35,9 +35,10 @@ export default function createPlugin(options: PartytownOptions): AstroIntegratio config = _config; }, 'astro:server:setup': ({ server }) => { + const lib = `${config.base}~partytown/`; server.middlewares.use( sirv(partytownLibDirectory, { - mount: '/~partytown', + mount: lib, dev: true, etag: true, extensions: [],