Skip to content

Commit 614da0b

Browse files
committed
Export: do not create subdirectories for links ending with .html - fixes sveltejs#1043
1 parent 636739f commit 614da0b

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

src/api/export.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ async function _export({
112112
const is_html = type === 'text/html';
113113

114114
if (is_html) {
115-
if (pathname !== '/service-worker-index.html') {
115+
if (pathname !== '/service-worker-index.html' && !file.endsWith('.html')) {
116116
file = file === '' ? 'index.html' : `${file}/index.html`;
117117
}
118118
body = minify_html(body);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script context="module">
2+
export function preload({ params }) {
3+
return params;
4+
}
5+
</script>
6+
7+
<script>
8+
export let a;
9+
export let b;
10+
</script>
11+
12+
<p>{a}/{b}.html</p>

test/apps/export/src/routes/boom/[a]/index.svelte

+1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212

1313
{#each list as b}
1414
<a href="boom/{a}/{b}">{a}/{b}</a>
15+
<a href="boom/{a}/{b}.html">{a}/{b}.html</a>
1516
{/each}

test/apps/export/test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ describe('export', function() {
2323
for (let a = 1; a <= 20; a += 1) {
2424
boom.push(`boom/${a}/index.html`);
2525
for (let b = 1; b <= 20; b += 1) {
26-
boom.push(`boom/${a}/${b}/index.html`);
26+
boom.push(`boom/${a}/${b}.html`);
27+
boom.push(`boom/${a}/${b}/index.html`);
2728
}
2829
}
2930

0 commit comments

Comments
 (0)