Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prerendering bails if files already exist #1039

Closed
Rich-Harris opened this issue Apr 15, 2021 · 0 comments · Fixed by #1040
Closed

Prerendering bails if files already exist #1039

Rich-Harris opened this issue Apr 15, 2021 · 0 comments · Fixed by #1040
Labels
bug Something isn't working

Comments

@Rich-Harris
Copy link
Member

Describe the bug
If you build an app with adapter-static without first clearing out the build directory, the prerenderer will bail if it encounters pages that were built in a previous run. This is bad.

Severity
Bad

Additional context
The issue stems from this code...

const file = parsed.pathname.replace(config.kit.paths.assets, '').slice(1);
const file_exists =
(file.startsWith(`${config.kit.appDir}/`) && existsSync(`${dir}/client/${file}`)) ||
existsSync(`${out}/${file}`) ||
existsSync(`${config.kit.files.assets}/${file}`) ||
existsSync(`${config.kit.files.assets}/${file}/index.html`);
if (file_exists) {
seen_files.add(resolved);
continue;
}
...which was necessary at one point because we needed to bail out of rendering if a static file corresponded to the request, and didn't have a better mechanism. Since we now generate a manifest of the contents of static, I'm pretty sure we can just use that (though we would also need to filter out the contents of appDir or make the prerenderer aware of those files individually as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant