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

HTML bundle loader #1732

Merged
merged 3 commits into from
Jul 16, 2018
Merged

HTML bundle loader #1732

merged 3 commits into from
Jul 16, 2018

Conversation

devongovett
Copy link
Member

Closes #1528. Closes #926. Closes #1017. Closes #1016.
Fixes #848. Fixes #178.

This is based on some of the work listed in the above PRs. Thanks @pierredavidbelanger and @stevengill.

Enables both async and "sync" HTML imports into JS.

  • import('./some.html')
  • import html from './some.html' or require('./some.html')

The reason "sync" is in quotes there is because it currently actually isn't sync. It works like "sync" WASM imports: some.html is still written out as a separate file, and the JS bundle preloads it before executing the bundle so that it appears synchronous to the code importing it but is actually async under the covers.

This may not be the desired outcome in all cases - sometimes you might actually want HTML to be inlined into the JS so it is actually synchronous (unlike WASM). This could be a future improvement. For now, that is too hard to implement since we need to actually run the HTML packager inside the JS packager to get the final HTML contents (not currently possible). In Parcel 2 we will be looking at doing composable packagers, which would solve both this and other issues like inlining JS/CSS into HTML (#1456).

@devongovett devongovett added this to the v1.10.0 milestone Jul 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants