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 diff --git a/packages/integrations/partytown/src/index.ts b/packages/integrations/partytown/src/index.ts index 425a0bc76636..789f974eb526 100644 --- a/packages/integrations/partytown/src/index.ts +++ b/packages/integrations/partytown/src/index.ts @@ -25,18 +25,20 @@ export default function createPlugin(options: PartytownOptions): AstroIntegratio name: '@astrojs/partytown', hooks: { 'astro:config:setup': ({ config: _config, command, injectScript }) => { + const lib = `${_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 }) => { 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: [],