Skip to content

Commit

Permalink
trim html before checking for doctype html fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott committed Dec 13, 2020
1 parent 968b01c commit 9492843
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion snowpack/src/build/build-import-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function wrapHtmlResponse({

// Full Page Transformations: Only full page responses should get these transformations.
// Any code not containing `<!DOCTYPE html>` is assumed to be an HTML fragment.
const isFullPage = code.toLowerCase().startsWith('<!doctype html>');
const isFullPage = code.trim().toLowerCase().startsWith('<!doctype html>');
if (hmr && !isFullPage && !config.buildOptions.htmlFragments) {
throw new Error(`HTML fragment found!
HTML fragments (files not starting with "<!doctype html>") are not transformed like full HTML pages.
Expand Down

1 comment on commit 9492843

@vercel
Copy link

@vercel vercel bot commented on 9492843 Dec 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.