Repository navigation
Support bundling HTML files and their js, css, and assets in Bun.build and bun build - #15940
Merged
Merged
Conversation
Collaborator
|
Updated 10:09 AM PT - Dec 23rd, 2024
✅ @Jarred-Sumner, your commit 806c4b2 has passed in 🧪 try this PR locally: bunx bun-pr 15940 |
Jarred-Sumner
marked this pull request as ready for review
December 22, 2024 15:08
small-angel
suggested changes
Dec 22, 2024
small-angel
left a comment
Contributor
There was a problem hiding this comment.
overall legendary pr. very nice to have this.
random nitpicks and two that should be considered before merging. the main logic looks fine
| // a <link rel="modulepreload" href="..." crossorigin> tag that | ||
| // points to the module or chunk's unique key so that we tell the | ||
| // browser to preload the user's code. | ||
| // We might also want to force <!DOCTYPE html> at the top of the file, but I'm not sure about that yet. |
Contributor
There was a problem hiding this comment.
its fine to take no action re:doctype
the one person who wants to bundle quirks mode html can do so
|
awesome !!! but would you fix #5241 ? this block we switch to bun build |
|
awesome addition! |
robobun
added a commit
that referenced
this pull request
Oct 29, 2026
…unk namer The note under `Multiple files share the same output path` names the naming option to change. The report chose `entry` or `chunk` with its own test. That test differs from the one in `compute_chunks` that chose the template: - The script and the stylesheet of a page printed `entry naming is '<chunk template>'` (since #15940). - A page that only `import()` reaches printed `chunk naming is '<entry template>'` (since #15940). - The entry point of an executable printed `entry naming is './[name]'` (since #41264, and for every collision with it since #41317). No naming option sets that template. - The report kept one template for each option, so a second template under one option replaced the first. `compute_chunks` now has one rule, `takes_entry_naming`. The namer and `chunk_named_by` both call it, and the report matches on the result of `chunk_named_by`. The chunk that `--compile` names after the output file gets no naming note. The report prints one note for each template of an option.
robobun
added a commit
that referenced
this pull request
Oct 29, 2026
…unk namer The note under `Multiple files share the same output path` names the naming option to change. The report chose `entry` or `chunk` with its own test. That test differs from the one in `compute_chunks` that chose the template: - The script and the stylesheet of a page printed `entry naming is '<chunk template>'` (since #15940). - A page that only `import()` reaches printed `chunk naming is '<entry template>'` (since #15940). - The entry point of an executable printed `entry naming is './[name]'` (since #41264, and for every collision with it since #41317). No naming option sets that template. - The report kept one template for each option, so a second template under one option replaced the first. `compute_chunks` now has one rule, `takes_entry_naming`. The namer and `chunk_named_by` both call it, and the report matches on the result of `chunk_named_by`. The chunk that `--compile` names after the output file gets no naming note. The report prints one note for each template of an option.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #4688
This lets you bundle HTML files in Bun. It uses
lol-htmlto parse and enqueue assets.Currently, elements matching the following selectors are considered for either bundling (if js/css) or copied when non-external:
script[src]link[rel='stylesheet'][href]link[as='style'][href]link[as='font'][href], link[type^='font/'][href]link[as='image'][href]link[as='video'][href], link[as='audio'][href]link[as='worker'][href]link[rel='manifest'][href]link[rel='icon'][href], link[rel='apple-touch-icon'][href]link:not([rel~='stylesheet']):not([rel~='modulepreload']):not([rel~='manifest']):not([rel~='icon']):not([rel~='apple-touch-icon'])[href]img[src]img[srcset]video[src]video[poster]audio[src]source[src]source[srcset]iframe[src]This list will probably change before this merges. It should probably be configurable.
How did you verify your code works?
There are tests.