vite-plugin-html-elements 0.1.2 β 0.1.3
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/index.js +5 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -62,22 +62,20 @@ function getRoutesEntries(routes, srcDir, debug) {
|
|
|
62
62
|
console.error(`β Route source not found: ${route.source} for path ${route.path}`);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
+
// Normalize path: remove trailing slash (except for root)
|
|
66
|
+
const normalizedPath = route.path === '/' ? '/' : route.path.replace(/\/$/, '');
|
|
65
67
|
// Convert route path to entry name
|
|
66
|
-
// '/' -> 'index'
|
|
67
|
-
// '/blog' -> 'blog/index'
|
|
68
|
-
// '/blog/today-is-nice' -> 'blog/today-is-nice/index'
|
|
69
68
|
let entryName;
|
|
70
|
-
if (
|
|
69
|
+
if (normalizedPath === '/') {
|
|
71
70
|
entryName = 'index';
|
|
72
71
|
}
|
|
73
72
|
else {
|
|
74
|
-
|
|
75
|
-
const cleanPath = route.path.replace(/^\//, '');
|
|
73
|
+
const cleanPath = normalizedPath.replace(/^\//, '');
|
|
76
74
|
entryName = `${cleanPath}/index`;
|
|
77
75
|
}
|
|
78
76
|
entries[entryName] = sourcePath;
|
|
79
77
|
if (debug) {
|
|
80
|
-
console.log(`πΊοΈ Route: ${
|
|
78
|
+
console.log(`πΊοΈ Route: ${normalizedPath} -> ${route.source} (output: ${entryName}.html)`);
|
|
81
79
|
}
|
|
82
80
|
});
|
|
83
81
|
return entries;
|