optimize deps
This commit is contained in:
16
src/pages/_document.tsx
Normal file
16
src/pages/_document.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { Head, Html, Main, NextScript } from "next/document";
|
||||||
|
import globalCss from "~/styles/globals.css?raw";
|
||||||
|
|
||||||
|
export default function Document() {
|
||||||
|
return (
|
||||||
|
<Html>
|
||||||
|
<Head>
|
||||||
|
<style dangerouslySetInnerHTML={{ __html: globalCss }} />
|
||||||
|
</Head>
|
||||||
|
<body>
|
||||||
|
<Main />
|
||||||
|
<NextScript />
|
||||||
|
</body>
|
||||||
|
</Html>
|
||||||
|
);
|
||||||
|
}
|
||||||
1
src/vite-env.d.ts
vendored
Normal file
1
src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
@@ -2,19 +2,28 @@ import { cloudflare } from "@cloudflare/vite-plugin";
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import vinext from "vinext";
|
import vinext from "vinext";
|
||||||
|
|
||||||
|
const reactOptimizeDeps = [
|
||||||
|
"react",
|
||||||
|
"react-dom",
|
||||||
|
"react-dom/client",
|
||||||
|
"react-dom/server.edge",
|
||||||
|
"react/jsx-dev-runtime",
|
||||||
|
"react/jsx-runtime",
|
||||||
|
];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vinext(), cloudflare()],
|
plugins: [vinext(), cloudflare()],
|
||||||
resolve: {
|
resolve: {
|
||||||
tsconfigPaths: true,
|
tsconfigPaths: true,
|
||||||
},
|
},
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
include: [
|
include: reactOptimizeDeps,
|
||||||
"react",
|
},
|
||||||
"react-dom",
|
environments: {
|
||||||
"react-dom/client",
|
vinext_boilerplate: {
|
||||||
"react-dom/server.edge",
|
optimizeDeps: {
|
||||||
"react/jsx-dev-runtime",
|
include: reactOptimizeDeps,
|
||||||
"react/jsx-runtime",
|
},
|
||||||
],
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user