diff --git a/packages/plugin-react-oxc/src/index.ts b/packages/plugin-react-oxc/src/index.ts index f234ad80..9de91bad 100644 --- a/packages/plugin-react-oxc/src/index.ts +++ b/packages/plugin-react-oxc/src/index.ts @@ -141,7 +141,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] { return [ { tag: 'script', - attrs: { type: 'module' }, + attrs: { type: 'module', async: true }, children: getPreambleCode(config.server!.config.base), }, ] diff --git a/packages/plugin-react-swc/src/index.ts b/packages/plugin-react-swc/src/index.ts index 6f20a05d..dd1a4dcf 100644 --- a/packages/plugin-react-swc/src/index.ts +++ b/packages/plugin-react-swc/src/index.ts @@ -147,7 +147,7 @@ const react = (_options?: Options): PluginOption[] => { return [ { tag: 'script', - attrs: { type: 'module' }, + attrs: { type: 'module', async: true }, children: getPreambleCode(config.server!.config.base), }, ] diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index 250c4477..1c3e1aef 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -366,7 +366,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] { return [ { tag: 'script', - attrs: { type: 'module' }, + attrs: { type: 'module', async: true }, children: getPreambleCode(config.server!.config.base), }, ]