@webjourney/vite-plugins 1.2.18 → 1.2.19
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/dist/build.js +12 -9
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -223,14 +223,15 @@ async function prerender(projectRoot) {
|
|
|
223
223
|
// Extract routes from App.tsx
|
|
224
224
|
const routes = await extractRoutes(projectRoot);
|
|
225
225
|
console.log(` Found ${routes.length} route(s): ${routes.join(', ')}`);
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
226
|
+
// TODO: @Darren temporarily disable sitemap generation
|
|
227
|
+
// Currently disabled because it causes spurious git diffs when building in different environments
|
|
228
|
+
// const hostname = process.env.WEBJOURNEY_PROJECT_ID ? `https://${process.env.WEBJOURNEY_PROJECT_ID}.web.wbj.dev` : 'http://127.0.0.1';
|
|
229
|
+
// const sitemap = generateSitemap(routes, hostname);
|
|
230
|
+
// await Promise.all([
|
|
231
|
+
// fs.writeFile(toAbsolute('public/sitemap.xml'), sitemap),
|
|
232
|
+
// fs.writeFile(toAbsolute('dist/sitemap.xml'), sitemap),
|
|
233
|
+
// ]);
|
|
234
|
+
// console.log(' Generated: sitemap.xml');
|
|
234
235
|
for (const route of routes) {
|
|
235
236
|
// Render the app HTML
|
|
236
237
|
const appHtml = renderToString(render(route));
|
|
@@ -246,7 +247,9 @@ async function prerender(projectRoot) {
|
|
|
246
247
|
// Write the pre-rendered HTML
|
|
247
248
|
const filePath = route === '/'
|
|
248
249
|
? toAbsolute('dist/index.html')
|
|
249
|
-
:
|
|
250
|
+
: route.endsWith('.html')
|
|
251
|
+
? toAbsolute(`dist${route}`)
|
|
252
|
+
: toAbsolute(`dist${route}/index.html`);
|
|
250
253
|
// Ensure directory exists
|
|
251
254
|
const dir = path.dirname(filePath);
|
|
252
255
|
await fs.mkdir(dir, { recursive: true });
|