feat(html): add CDN bundles and inline template minification#827
feat(html): add CDN bundles and inline template minification#827
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📦 Bundle Size Report🎨 @videojs/html
Presets (7)
Media (4)
Players (3)
Skins (14)
UI Components (21)
Sizes are marginal over the root entry point. ⚛️ @videojs/react(no changes) Presets (7)
Media (3)
Skins (14)
UI Components (17)
Sizes are marginal over the root entry point. 🧩 @videojs/core(no changes) Entries (5)
🏷️ @videojs/element(no changes) Entries (2)
📦 @videojs/store(no changes) Entries (3)
🔧 @videojs/utils(no changes) Entries (10)
📦 @videojs/spf(no changes) Entries (3)
ℹ️ How to interpretAll sizes are standalone totals (minified + brotli).
Run |
| s = s.replace(/<!--[\s\S]*?-->/g, ''); | ||
|
|
||
| // 2. Collapse runs of whitespace to a single space. | ||
| s = s.replace(/\s{2,}/g, ' '); |
There was a problem hiding this comment.
question(non-blocking): since whitespace can affect actual sizing/layout (text under some cases, but also parent/child/sibling DOM element layout behaviors), do we need to worry about this?
There was a problem hiding this comment.
Good question! That line is collapsing multiple whitespaces into a single which browsers normally do. I think for our library this is safe. Happy to review later if something funky comes up.
luwes
left a comment
There was a problem hiding this comment.
Really cool stuff in here. I'm hesitant to add a new package for all this.
Can we discuss this first?
My S1 is to keep this all in the html package if possible.
Add self-contained ESM bundles for CDN delivery inside @videojs/html. Each entry (video, audio, background, media/*) builds as a single file with zero external imports via per-entry tsdown configs. Build plugins minify inline CSS (?inline imports via lightningcss) and tagged template literals (/*html*/ and /* css */ markers) in production builds. Dev builds preserve readability with .dev.js suffix.
0f99c2a to
c123d3d
Compare
CI Failure Diagnosis
|
CDN entry files use self-referencing imports that resolve to built .d.ts files, causing duplicate HTMLElementTagNameMap declarations. Exclude src/cdn from tsconfig since tsdown handles these separately. Also wire build:cdn into both CI (build job) and CD (release job) so CDN bundles are validated in PRs and included in published packages.
Replace self-referencing package imports with relative paths so cdn entry files resolve to source modules. This avoids duplicate HTMLElementTagNameMap declarations that caused TS2717 and removes the tsconfig exclude workaround. Add inlineCssPlugin and inlineTemplatePlugin to the cdn build config since relative imports resolve source files that contain ?inline CSS imports and tagged template literals.
Summary
Add self-contained ESM bundles for CDN delivery inside
@videojs/html. Each entry (video, audio, background, media/*) builds as a single file with zero external imports. Build plugins minify inline CSS and tagged template literals in production builds.Changes
@videojs/html/cdn/— no separate packageinlineTemplatePluginminifies/*html*/and/* css */tagged template literals via lightningcssinlineCssPlugingainsminifyoption (default:true) for?inlineCSS importsbuild:cdnwired into CI (build job) and CD (release job)@videojs/html/cdn/Implementation details
inlineCssPluginandinlineTemplatePluginto handle?inlineCSS and tagged template minification__DEV__is replaced viadefine— CDN dev setstrue, prod setsfalse${...}expressions with proper brace/string/nested-template tracking; CSS expressions are replaced with placeholder tokens before lightningcss runs, then restoredTesting
Bundle sizes