Fix React dev mode using a base (#8428)
This commit is contained in:
parent
1947ef7a99
commit
67e8348594
4 changed files with 7 additions and 7 deletions
5
.changeset/cold-knives-peel.md
Normal file
5
.changeset/cold-knives-peel.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/react': patch
|
||||
---
|
||||
|
||||
Fix React dev mode using a base
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -4515,9 +4515,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)
|
||||
|
|
Loading…
Reference in a new issue