Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Export fails if html has no <base> #1202

Closed
wyozi opened this issue May 16, 2020 · 1 comment · Fixed by #1208
Closed

Export fails if html has no <base> #1202

wyozi opened this issue May 16, 2020 · 1 comment · Fixed by #1208
Labels

Comments

@wyozi
Copy link

wyozi commented May 16, 2020

Describe the bug
Export will fail with a bad error message if Svelte has a route serving .html that does not contain <base> tag.

The problematic code is

sapper/src/api/export.ts

Lines 188 to 190 in 4a0ffd1

const base_match = /<base ([\s\S]+?)>/m.exec(cleaned);
const base_href = base_match && get_href(base_match[1]);
const base = resolve(url.href, base_href);

If there is no base_match, there won't be base_href either so resolve will receive undefined as the second argument.

I think it might be safe to replace base_href with basepath received from options, but not sure.

@Conduitry
Copy link
Member

I believe this is the second of the two issues that #1118 is intended to address.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants