diff --git a/.changeset/cold-knives-peel.md b/.changeset/cold-knives-peel.md new file mode 100644 index 000000000000..56ef2aff0c19 --- /dev/null +++ b/.changeset/cold-knives-peel.md @@ -0,0 +1,5 @@ +--- +'@astrojs/react': patch +--- + +Fix React dev mode using a base diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index 2b9558e31873..94814bdd241e 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -45,7 +45,6 @@ "dev": "astro-scripts dev \"src/**/*.ts\"" }, "dependencies": { - "@astrojs/internal-helpers": "0.2.0", "@vitejs/plugin-react": "^4.0.4", "ultrahtml": "^1.3.0" }, diff --git a/packages/integrations/react/src/index.ts b/packages/integrations/react/src/index.ts index a09544baf9f9..2a78ce9cd0a3 100644 --- a/packages/integrations/react/src/index.ts +++ b/packages/integrations/react/src/index.ts @@ -1,4 +1,3 @@ -import { appendForwardSlash } from '@astrojs/internal-helpers/path'; import react, { type Options as ViteReactPluginOptions } from '@vitejs/plugin-react'; import type { AstroIntegration } from 'astro'; import { version as ReactVersion } from 'react-dom'; @@ -94,7 +93,7 @@ export default function ({ return { name: '@astrojs/react', hooks: { - 'astro:config:setup': ({ config, command, addRenderer, updateConfig, injectScript }) => { + 'astro:config:setup': ({ command, addRenderer, updateConfig, injectScript }) => { addRenderer(getRenderer()); updateConfig({ vite: getViteConfiguration({ include, exclude, experimentalReactChildren }), @@ -102,7 +101,7 @@ export default function ({ if (command === 'dev') { const preamble = FAST_REFRESH_PREAMBLE.replace( `__BASE__`, - appendForwardSlash(config.base) + '/' ); injectScript('before-hydration', preamble); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c2f3c68e783e..78fd20edd102 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4514,9 +4514,6 @@ importers: packages/integrations/react: dependencies: - '@astrojs/internal-helpers': - specifier: 0.2.0 - version: link:../../internal-helpers '@vitejs/plugin-react': specifier: ^4.0.4 version: 4.0.4(vite@4.4.9)