vite-react-ssg 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/bin/vite-react-ssg.js +0 -0
- package/dist/client/single-page.cjs +3 -3
- package/dist/client/single-page.mjs +4 -4
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +5 -5
- package/dist/node/cli.cjs +1 -1
- package/dist/node/cli.mjs +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.mjs +1 -1
- package/dist/shared/{vite-react-ssg.DObRRhiz.mjs → vite-react-ssg.BdRX-qCI.mjs} +4 -8
- package/dist/shared/{vite-react-ssg.B6SGTWpD.mjs → vite-react-ssg.DdDMKzrS.mjs} +1 -1
- package/dist/shared/{vite-react-ssg.D5dVt1Iv.cjs → vite-react-ssg.U7W0lHXm.cjs} +5 -9
- package/dist/shared/{vite-react-ssg.BuZVBVT6.cjs → vite-react-ssg.yL7u7OP5.cjs} +1 -1
- package/dist/tanstack.cjs +4 -4
- package/dist/tanstack.mjs +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,6 +7,9 @@ See demo(also document): [docs](https://vite-react-ssg.netlify.app/)
|
|
|
7
7
|
**🎈 Support for [`@tanstack/router`](https://tanstack.com/router/latest/docs/framework/react/overview)
|
|
8
8
|
and [`wouter`](https://github.com/molefrog/wouter) is in progress!**
|
|
9
9
|
|
|
10
|
+
Support for the [`@tanstack/router`](https://tanstack.com/router/latest/docs/framework/react/overview) router is still experimental, and `pathname.lazy.tsx routes` are not yet supported.
|
|
11
|
+
For usage examples, see: [`main`/examples/tanstack/src/main.tsx](https://github.com/Daydreamer-riri/vite-react-ssg/blob/main/examples/tanstack/src/main.tsx)
|
|
12
|
+
|
|
10
13
|
[](https://www.npmjs.com/package/vite-react-ssg)
|
|
11
14
|
|
|
12
15
|
## Table of contents
|
package/bin/vite-react-ssg.js
CHANGED
|
File without changes
|
|
@@ -4,7 +4,7 @@ const jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
const client = require('react-dom/client');
|
|
5
5
|
const reactHelmetAsync = require('react-helmet-async');
|
|
6
6
|
const React = require('react');
|
|
7
|
-
const ClientOnly = require('../shared/vite-react-ssg.
|
|
7
|
+
const ClientOnly = require('../shared/vite-react-ssg.yL7u7OP5.cjs');
|
|
8
8
|
const state = require('../shared/vite-react-ssg.CjsEygxB.cjs');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
@@ -18,7 +18,7 @@ function ViteReactSSG(App, fn, options = {}) {
|
|
|
18
18
|
ssrWhenDev,
|
|
19
19
|
getStyleCollector = null
|
|
20
20
|
} = options;
|
|
21
|
-
if (
|
|
21
|
+
if (process.env.NODE_ENV === "development" && ssrWhenDev !== void 0)
|
|
22
22
|
console.warn("[vite-react-ssg] `ssrWhenDev` option is no longer needed. If you want to use csr, just replace `vite-react-ssg dev` with `vite`.");
|
|
23
23
|
const isClient = typeof window !== "undefined";
|
|
24
24
|
async function createRoot(client = false, routePath) {
|
|
@@ -64,7 +64,7 @@ function ViteReactSSG(App, fn, options = {}) {
|
|
|
64
64
|
await createRoot(true);
|
|
65
65
|
const app = /* @__PURE__ */ jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: App });
|
|
66
66
|
const isSSR = document.querySelector("[data-server-rendered=true]") !== null;
|
|
67
|
-
if (!isSSR &&
|
|
67
|
+
if (!isSSR && process.env.NODE_ENV === "development") {
|
|
68
68
|
const root = client.createRoot(container);
|
|
69
69
|
React__default.startTransition(() => {
|
|
70
70
|
root.render(app);
|
|
@@ -2,8 +2,8 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
3
3
|
import { HelmetProvider } from 'react-helmet-async';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { d as documentReady } from '../shared/vite-react-ssg.
|
|
6
|
-
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.
|
|
5
|
+
import { d as documentReady } from '../shared/vite-react-ssg.DdDMKzrS.mjs';
|
|
6
|
+
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.DdDMKzrS.mjs';
|
|
7
7
|
import { d as deserializeState } from '../shared/vite-react-ssg.C6pK7rvr.mjs';
|
|
8
8
|
|
|
9
9
|
function ViteReactSSG(App, fn, options = {}) {
|
|
@@ -13,7 +13,7 @@ function ViteReactSSG(App, fn, options = {}) {
|
|
|
13
13
|
ssrWhenDev,
|
|
14
14
|
getStyleCollector = null
|
|
15
15
|
} = options;
|
|
16
|
-
if (
|
|
16
|
+
if (process.env.NODE_ENV === "development" && ssrWhenDev !== void 0)
|
|
17
17
|
console.warn("[vite-react-ssg] `ssrWhenDev` option is no longer needed. If you want to use csr, just replace `vite-react-ssg dev` with `vite`.");
|
|
18
18
|
const isClient = typeof window !== "undefined";
|
|
19
19
|
async function createRoot$1(client = false, routePath) {
|
|
@@ -59,7 +59,7 @@ function ViteReactSSG(App, fn, options = {}) {
|
|
|
59
59
|
await createRoot$1(true);
|
|
60
60
|
const app = /* @__PURE__ */ jsx(HelmetProvider, { children: App });
|
|
61
61
|
const isSSR = document.querySelector("[data-server-rendered=true]") !== null;
|
|
62
|
-
if (!isSSR &&
|
|
62
|
+
if (!isSSR && process.env.NODE_ENV === "development") {
|
|
63
63
|
const root = createRoot(container);
|
|
64
64
|
React.startTransition(() => {
|
|
65
65
|
root.render(app);
|
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const React = require('react');
|
|
|
5
5
|
const client = require('react-dom/client');
|
|
6
6
|
const reactHelmetAsync = require('react-helmet-async');
|
|
7
7
|
const reactRouterDom = require('react-router-dom');
|
|
8
|
-
const ClientOnly = require('./shared/vite-react-ssg.
|
|
8
|
+
const ClientOnly = require('./shared/vite-react-ssg.yL7u7OP5.cjs');
|
|
9
9
|
const state = require('./shared/vite-react-ssg.CjsEygxB.cjs');
|
|
10
10
|
const path = require('./shared/vite-react-ssg.CFQGqC60.cjs');
|
|
11
11
|
const remixRouter = require('./shared/vite-react-ssg.C2GpVZF1.cjs');
|
|
@@ -84,7 +84,7 @@ function ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
84
84
|
ssrWhenDev,
|
|
85
85
|
getStyleCollector = null
|
|
86
86
|
} = options;
|
|
87
|
-
if (
|
|
87
|
+
if (process.env.NODE_ENV === "development" && ssrWhenDev !== void 0)
|
|
88
88
|
console.warn("[vite-react-ssg] `ssrWhenDev` option is no longer needed. If you want to use csr, just replace `vite-react-ssg dev` with `vite`.");
|
|
89
89
|
const isClient = typeof window !== "undefined";
|
|
90
90
|
const BASE_URL = routerOptions.basename ?? "/";
|
|
@@ -143,7 +143,7 @@ function ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
143
143
|
const { router } = await createRoot(true);
|
|
144
144
|
const app = /* @__PURE__ */ jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.RouterProvider, { router }) });
|
|
145
145
|
const isSSR = document.querySelector("[data-server-rendered=true]") !== null;
|
|
146
|
-
if (!isSSR &&
|
|
146
|
+
if (!isSSR && process.env.NODE_ENV === "development") {
|
|
147
147
|
const root = client.createRoot(container);
|
|
148
148
|
React__default.startTransition(() => {
|
|
149
149
|
root.render(app);
|
|
@@ -162,7 +162,7 @@ function ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
162
162
|
return route;
|
|
163
163
|
}
|
|
164
164
|
const loader = async ({ request }) => {
|
|
165
|
-
if (
|
|
165
|
+
if (process.env.NODE_ENV === "development") {
|
|
166
166
|
const routeId = encodeURIComponent(route.id);
|
|
167
167
|
const dataQuery = `_data=${routeId}`;
|
|
168
168
|
const url = request.url.includes("?") ? `${request.url}&${dataQuery}` : `${request.url}?${dataQuery}`;
|
package/dist/index.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import React, { forwardRef } from 'react';
|
|
|
3
3
|
import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
4
4
|
import { HelmetProvider } from 'react-helmet-async';
|
|
5
5
|
import { useLinkClickHandler, Link as Link$1, NavLink as NavLink$1, matchRoutes, createBrowserRouter, RouterProvider } from 'react-router-dom';
|
|
6
|
-
import { d as documentReady } from './shared/vite-react-ssg.
|
|
7
|
-
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.
|
|
6
|
+
import { d as documentReady } from './shared/vite-react-ssg.DdDMKzrS.mjs';
|
|
7
|
+
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.DdDMKzrS.mjs';
|
|
8
8
|
import { d as deserializeState } from './shared/vite-react-ssg.C6pK7rvr.mjs';
|
|
9
9
|
import { j as joinUrlSegments, w as withLeadingSlash, s as stripBase } from './shared/vite-react-ssg.CjIppNIS.mjs';
|
|
10
10
|
import { c as convertRoutesToDataRoutes } from './shared/vite-react-ssg.C0y5wbxl.mjs';
|
|
@@ -79,7 +79,7 @@ function ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
79
79
|
ssrWhenDev,
|
|
80
80
|
getStyleCollector = null
|
|
81
81
|
} = options;
|
|
82
|
-
if (
|
|
82
|
+
if (process.env.NODE_ENV === "development" && ssrWhenDev !== void 0)
|
|
83
83
|
console.warn("[vite-react-ssg] `ssrWhenDev` option is no longer needed. If you want to use csr, just replace `vite-react-ssg dev` with `vite`.");
|
|
84
84
|
const isClient = typeof window !== "undefined";
|
|
85
85
|
const BASE_URL = routerOptions.basename ?? "/";
|
|
@@ -138,7 +138,7 @@ function ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
138
138
|
const { router } = await createRoot$1(true);
|
|
139
139
|
const app = /* @__PURE__ */ jsx(HelmetProvider, { children: /* @__PURE__ */ jsx(RouterProvider, { router }) });
|
|
140
140
|
const isSSR = document.querySelector("[data-server-rendered=true]") !== null;
|
|
141
|
-
if (!isSSR &&
|
|
141
|
+
if (!isSSR && process.env.NODE_ENV === "development") {
|
|
142
142
|
const root = createRoot(container);
|
|
143
143
|
React.startTransition(() => {
|
|
144
144
|
root.render(app);
|
|
@@ -157,7 +157,7 @@ function ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
157
157
|
return route;
|
|
158
158
|
}
|
|
159
159
|
const loader = async ({ request }) => {
|
|
160
|
-
if (
|
|
160
|
+
if (process.env.NODE_ENV === "development") {
|
|
161
161
|
const routeId = encodeURIComponent(route.id);
|
|
162
162
|
const dataQuery = `_data=${routeId}`;
|
|
163
163
|
const url = request.url.includes("?") ? `${request.url}&${dataQuery}` : `${request.url}?${dataQuery}`;
|
package/dist/node/cli.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const kolorist = require('kolorist');
|
|
4
4
|
const yargs = require('yargs');
|
|
5
5
|
const helpers = require('yargs/helpers');
|
|
6
|
-
const dev = require('../shared/vite-react-ssg.
|
|
6
|
+
const dev = require('../shared/vite-react-ssg.U7W0lHXm.cjs');
|
|
7
7
|
const webFetch = require('@remix-run/web-fetch');
|
|
8
8
|
require('node:path');
|
|
9
9
|
require('node:module');
|
package/dist/node/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gray, bold, red, reset, underline } from 'kolorist';
|
|
2
2
|
import yargs from 'yargs';
|
|
3
3
|
import { hideBin } from 'yargs/helpers';
|
|
4
|
-
import { b as build, d as dev } from '../shared/vite-react-ssg.
|
|
4
|
+
import { b as build, d as dev } from '../shared/vite-react-ssg.BdRX-qCI.mjs';
|
|
5
5
|
import { Headers, Request, Response, fetch, FormData } from '@remix-run/web-fetch';
|
|
6
6
|
import 'node:path';
|
|
7
7
|
import 'node:module';
|
package/dist/node.cjs
CHANGED
package/dist/node.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { once } from 'node:events';
|
|
|
15
15
|
import { c as convertRoutesToDataRoutes } from './vite-react-ssg.C0y5wbxl.mjs';
|
|
16
16
|
import { M as META_CONTAINER_ID } from './vite-react-ssg.B-j07kW6.mjs';
|
|
17
17
|
|
|
18
|
-
const version = "0.8.
|
|
18
|
+
const version = "0.8.1";
|
|
19
19
|
|
|
20
20
|
function buildLog(text, count) {
|
|
21
21
|
console.log(`
|
|
@@ -747,8 +747,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
747
747
|
}
|
|
748
748
|
},
|
|
749
749
|
customLogger: clientLogger,
|
|
750
|
-
mode: config.mode
|
|
751
|
-
ssr: { noExternal: ["vite-react-ssg"] }
|
|
750
|
+
mode: config.mode
|
|
752
751
|
}));
|
|
753
752
|
if (mock) {
|
|
754
753
|
const { jsdomGlobal } = await import('../chunks/jsdomGlobal.mjs');
|
|
@@ -780,8 +779,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
780
779
|
}
|
|
781
780
|
}
|
|
782
781
|
},
|
|
783
|
-
mode: config.mode
|
|
784
|
-
ssr: { noExternal: ["vite-react-ssg", "vite-react-ssg/tanstack"] }
|
|
782
|
+
mode: config.mode
|
|
785
783
|
}));
|
|
786
784
|
const prefix = format === "esm" && process.platform === "win32" ? "file://" : "";
|
|
787
785
|
const ext = format === "esm" ? ".mjs" : ".cjs";
|
|
@@ -1015,9 +1013,7 @@ ${err.stack}`
|
|
|
1015
1013
|
})
|
|
1016
1014
|
]
|
|
1017
1015
|
},
|
|
1018
|
-
{
|
|
1019
|
-
ssr: { noExternal: ["vite-react-ssg"] }
|
|
1020
|
-
}
|
|
1016
|
+
{}
|
|
1021
1017
|
)
|
|
1022
1018
|
);
|
|
1023
1019
|
await viteServer.listen();
|
|
@@ -29,7 +29,7 @@ function ClientOnly({
|
|
|
29
29
|
}) {
|
|
30
30
|
const isBrowser = useIsClient();
|
|
31
31
|
if (isBrowser) {
|
|
32
|
-
if (typeof children !== "function" &&
|
|
32
|
+
if (typeof children !== "function" && process.env.NODE_ENV === "development") {
|
|
33
33
|
throw new Error(
|
|
34
34
|
`vite-react-ssg error: The children of <ClientOnly> must be a "render function", e.g. <ClientOnly>{() => <span>{window.location.href}</span>}</ClientOnly>.
|
|
35
35
|
Current type: ${isValidElement(children) ? "React element" : typeof children}`
|
|
@@ -23,7 +23,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
23
23
|
const PQueue__default = /*#__PURE__*/_interopDefaultCompat(PQueue);
|
|
24
24
|
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
25
25
|
|
|
26
|
-
const version = "0.8.
|
|
26
|
+
const version = "0.8.1";
|
|
27
27
|
|
|
28
28
|
function buildLog(text, count) {
|
|
29
29
|
console.log(`
|
|
@@ -755,8 +755,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
755
755
|
}
|
|
756
756
|
},
|
|
757
757
|
customLogger: clientLogger,
|
|
758
|
-
mode: config.mode
|
|
759
|
-
ssr: { noExternal: ["vite-react-ssg"] }
|
|
758
|
+
mode: config.mode
|
|
760
759
|
}));
|
|
761
760
|
if (mock) {
|
|
762
761
|
const { jsdomGlobal } = await import('../chunks/jsdomGlobal.cjs');
|
|
@@ -788,14 +787,13 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
788
787
|
}
|
|
789
788
|
}
|
|
790
789
|
},
|
|
791
|
-
mode: config.mode
|
|
792
|
-
ssr: { noExternal: ["vite-react-ssg", "vite-react-ssg/tanstack"] }
|
|
790
|
+
mode: config.mode
|
|
793
791
|
}));
|
|
794
792
|
const prefix = format === "esm" && process.platform === "win32" ? "file://" : "";
|
|
795
793
|
const ext = format === "esm" ? ".mjs" : ".cjs";
|
|
796
794
|
const serverEntry = node_path.join(prefix, ssgOut, node_path.parse(ssrEntry).name + ext);
|
|
797
795
|
const serverManifest = JSON.parse(await fs__default.readFile(node_path.join(ssgOut, ...dotVitedir, "manifest.json"), "utf-8"));
|
|
798
|
-
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/vite-react-ssg.
|
|
796
|
+
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/vite-react-ssg.U7W0lHXm.cjs', document.baseURI).href)));
|
|
799
797
|
const { createRoot, includedRoutes: serverEntryIncludedRoutes } = format === "esm" ? await import(serverEntry) : _require(serverEntry);
|
|
800
798
|
const includedRoutes = serverEntryIncludedRoutes || configIncludedRoutes;
|
|
801
799
|
const { routes } = await createRoot(false);
|
|
@@ -1023,9 +1021,7 @@ ${err.stack}`
|
|
|
1023
1021
|
})
|
|
1024
1022
|
]
|
|
1025
1023
|
},
|
|
1026
|
-
{
|
|
1027
|
-
ssr: { noExternal: ["vite-react-ssg"] }
|
|
1028
|
-
}
|
|
1024
|
+
{}
|
|
1029
1025
|
)
|
|
1030
1026
|
);
|
|
1031
1027
|
await viteServer.listen();
|
|
@@ -31,7 +31,7 @@ function ClientOnly({
|
|
|
31
31
|
}) {
|
|
32
32
|
const isBrowser = useIsClient();
|
|
33
33
|
if (isBrowser) {
|
|
34
|
-
if (typeof children !== "function" &&
|
|
34
|
+
if (typeof children !== "function" && process.env.NODE_ENV === "development") {
|
|
35
35
|
throw new Error(
|
|
36
36
|
`vite-react-ssg error: The children of <ClientOnly> must be a "render function", e.g. <ClientOnly>{() => <span>{window.location.href}</span>}</ClientOnly>.
|
|
37
37
|
Current type: ${React.isValidElement(children) ? "React element" : typeof children}`
|
package/dist/tanstack.cjs
CHANGED
|
@@ -6,7 +6,7 @@ const client = require('react-dom/client');
|
|
|
6
6
|
const reactHelmetAsync = require('react-helmet-async');
|
|
7
7
|
const reactRouter = require('@tanstack/react-router');
|
|
8
8
|
const start = require('@tanstack/start');
|
|
9
|
-
const ClientOnly = require('./shared/vite-react-ssg.
|
|
9
|
+
const ClientOnly = require('./shared/vite-react-ssg.yL7u7OP5.cjs');
|
|
10
10
|
const state = require('./shared/vite-react-ssg.CjsEygxB.cjs');
|
|
11
11
|
const tanstackRouter = require('./shared/vite-react-ssg.DWHmkjdM.cjs');
|
|
12
12
|
const path = require('./shared/vite-react-ssg.CFQGqC60.cjs');
|
|
@@ -23,7 +23,7 @@ function Experimental_ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
23
23
|
ssrWhenDev,
|
|
24
24
|
getStyleCollector = null
|
|
25
25
|
} = options;
|
|
26
|
-
if (
|
|
26
|
+
if (process.env.NODE_ENV === "development" && ssrWhenDev !== void 0)
|
|
27
27
|
console.warn("[vite-react-ssg] `ssrWhenDev` option is no longer needed. If you want to use csr, just replace `vite-react-ssg dev` with `vite`.");
|
|
28
28
|
const isClient = typeof window !== "undefined";
|
|
29
29
|
const BASE_URL = routerOptions.basename ?? "/";
|
|
@@ -49,7 +49,7 @@ function Experimental_ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
49
49
|
return;
|
|
50
50
|
node.options.loader = async (ctx) => {
|
|
51
51
|
let pathname = ctx.location.pathname;
|
|
52
|
-
if (
|
|
52
|
+
if (process.env.NODE_ENV === "development") {
|
|
53
53
|
const routeId = encodeURIComponent(node.id);
|
|
54
54
|
const dataQuery = `_data=${routeId}`;
|
|
55
55
|
const href = ctx.location.href;
|
|
@@ -124,7 +124,7 @@ function Experimental_ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
124
124
|
}
|
|
125
125
|
const { router } = await createRoot(true);
|
|
126
126
|
const isSSR = document.querySelector("[data-server-rendered=true]") !== null;
|
|
127
|
-
if (!isSSR &&
|
|
127
|
+
if (!isSSR && process.env.NODE_ENV === "development") {
|
|
128
128
|
const root = client.createRoot(container);
|
|
129
129
|
React__default.startTransition(() => {
|
|
130
130
|
root.render(
|
package/dist/tanstack.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
|
4
4
|
import { HelmetProvider } from 'react-helmet-async';
|
|
5
5
|
import { RouterProvider } from '@tanstack/react-router';
|
|
6
6
|
import { StartClient, Meta } from '@tanstack/start';
|
|
7
|
-
import { d as documentReady } from './shared/vite-react-ssg.
|
|
8
|
-
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.
|
|
7
|
+
import { d as documentReady } from './shared/vite-react-ssg.DdDMKzrS.mjs';
|
|
8
|
+
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.DdDMKzrS.mjs';
|
|
9
9
|
import { d as deserializeState } from './shared/vite-react-ssg.C6pK7rvr.mjs';
|
|
10
10
|
import { M as META_CONTAINER_ID, c as convertRouteTreeToRouteOption } from './shared/vite-react-ssg.B-j07kW6.mjs';
|
|
11
11
|
export { r as registerPaths } from './shared/vite-react-ssg.B-j07kW6.mjs';
|
|
@@ -19,7 +19,7 @@ function Experimental_ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
19
19
|
ssrWhenDev,
|
|
20
20
|
getStyleCollector = null
|
|
21
21
|
} = options;
|
|
22
|
-
if (
|
|
22
|
+
if (process.env.NODE_ENV === "development" && ssrWhenDev !== void 0)
|
|
23
23
|
console.warn("[vite-react-ssg] `ssrWhenDev` option is no longer needed. If you want to use csr, just replace `vite-react-ssg dev` with `vite`.");
|
|
24
24
|
const isClient = typeof window !== "undefined";
|
|
25
25
|
const BASE_URL = routerOptions.basename ?? "/";
|
|
@@ -45,7 +45,7 @@ function Experimental_ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
45
45
|
return;
|
|
46
46
|
node.options.loader = async (ctx) => {
|
|
47
47
|
let pathname = ctx.location.pathname;
|
|
48
|
-
if (
|
|
48
|
+
if (process.env.NODE_ENV === "development") {
|
|
49
49
|
const routeId = encodeURIComponent(node.id);
|
|
50
50
|
const dataQuery = `_data=${routeId}`;
|
|
51
51
|
const href = ctx.location.href;
|
|
@@ -120,7 +120,7 @@ function Experimental_ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
120
120
|
}
|
|
121
121
|
const { router } = await createRoot$1(true);
|
|
122
122
|
const isSSR = document.querySelector("[data-server-rendered=true]") !== null;
|
|
123
|
-
if (!isSSR &&
|
|
123
|
+
if (!isSSR && process.env.NODE_ENV === "development") {
|
|
124
124
|
const root = createRoot(container);
|
|
125
125
|
React.startTransition(() => {
|
|
126
126
|
root.render(
|
package/package.json
CHANGED