Bugfix. Extract react imports from main bundler to vendor static files
This commit is contained in:
@@ -11,6 +11,18 @@ export default function virtualFilesPlugin({ entryToPage }) {
|
||||
namespace: "hydration-virtual",
|
||||
};
|
||||
});
|
||||
build.onResolve({ filter: /node_modules\/react(-dom)?/ }, (args) => ({
|
||||
path: args.path.includes("react-dom")
|
||||
? args.path.includes("client")
|
||||
? "react-dom/client"
|
||||
: "react-dom"
|
||||
: args.path.includes("jsx-dev")
|
||||
? "react/jsx-dev-runtime"
|
||||
: args.path.includes("jsx")
|
||||
? "react/jsx-runtime"
|
||||
: "react",
|
||||
external: true,
|
||||
}));
|
||||
build.onLoad({ filter: /.*/, namespace: "hydration-virtual" }, (args) => {
|
||||
const target = entryToPage.get(args.path);
|
||||
if (!target?.tsx)
|
||||
|
||||
Reference in New Issue
Block a user