Skip to content

Commit

Permalink
RNW-Vite: Split out react plugin from reactNativeWeb
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Nov 4, 2024
1 parent 6f9594f commit ffdd93c
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions code/frameworks/react-native-web-vite/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@ function reactNativeWeb(
): PluginOption {
return {
name: 'vite:react-native-web',
enforce: 'pre',
config(_userConfig, env) {
return {
plugins: [
react({
jsxRuntime: 'automatic',
...reactOptions,
}),
],
define: {
// reanimated support
'global.__x': {},
Expand Down Expand Up @@ -75,9 +68,19 @@ export const viteFinal: StorybookConfig['viteFinal'] = async (config, options) =

const { plugins = [] } = config;

if (!(await hasVitePlugins(plugins, ['vite:react-native-web']))) {
plugins.push(reactNativeWeb(pluginReactOptions));
}
// if (!(await hasVitePlugins(plugins, ['vite:react-native-web']))) {
plugins.push(
react({
babel: {
babelrc: false,
configFile: false,
},
jsxRuntime: 'automatic',
...pluginReactOptions,
})
);
plugins.push(reactNativeWeb(pluginReactOptions));
//}

return config;
};
Expand Down

0 comments on commit ffdd93c

Please sign in to comment.