vite-plugin-inline-multipage 1.0.12 → 1.0.13

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -58,10 +58,12 @@ export default function inlineEverythingPlugin(options) {
58
58
  $('link[rel="modulepreload"]').remove();
59
59
  $('link[rel="preload"]').remove();
60
60
  $('script[data-sveltekit-hydrate]').remove();
61
- const originalName = path.basename(htmlFile, '.html');
62
- const isRouteFile = remapKeys.has(originalName);
61
+ const relPath = path.relative(resolvedBuildDir, htmlFile);
62
+ const match = relPath.match(/^(.*?)\/index\.html$/);
63
+ const routeKey = match ? match[1] : path.basename(htmlFile, '.html');
64
+ const isRouteFile = remapKeys.has(routeKey);
63
65
  if (isRouteFile) {
64
- const remappedName = remap[originalName];
66
+ const remappedName = remap[routeKey];
65
67
  const remappedPath = path.join(path.dirname(htmlFile), remappedName);
66
68
  fs.writeFileSync(remappedPath, $.html());
67
69
  if (remappedPath !== htmlFile) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-inline-multipage",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "A Vite plugin that inlines multi-paged applications (like in svelte) to multiple html files",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",