docs(html-to-docx): browser ESM build + exports map (zero-config bundler imports) - #8
docs(html-to-docx): browser ESM build + exports map (zero-config bundler imports)#8nicolasiscoding wants to merge 3 commits into
Conversation
…-config bundler imports Update the html-to-docx skill for the new packaging: four dist builds (adds browser.esm.js), the exports map that auto-resolves the browser condition, corrected ~1.6 MB sizes (was ~2.4 MB), and a zero-config Path 1 bundler import (no alias/polyfills). Also fix the download object-URL revoke timing and add a Next.js dynamic-import note. Bumps skill to 1.3.0.
|
🔗 Depends on: TurboDocx/html-to-docx#205, which adds the browser ESM build ( Merge order: land and publish #205 first, then merge this. The guidance here already produces working client-side code on current versions, but the |
#205 makes `npm run build` emit four artifacts (adds browser.esm.js) and changes `BUILD_TARGET=browser` to emit both browser builds, not the IIFE only. Update the build-command notes to match (verified by building #205). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Kushal <kushalkumargupta4@gmail.com>
Code reviewTwo documentation-consistency observations. Both are below the confidence bar this review normally posts at, so treat them as judgement calls rather than blockers. Three candidate issues were checked and dismissed as false positives: the
quickstart/skills/turbodocx-html-to-docx/SKILL.md Lines 11 to 13 in 337f1ee The caveat it omits: quickstart/skills/turbodocx-html-to-docx/references/usage.md Lines 287 to 289 in 337f1ee
Lines 413 to 415 in 337f1ee Worth noting this is arguably by design — no existing eval pins a version, and npm installs latest by default. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
🚫 Do not merge yet — blocked by a runtime bug in the libraryTested this PR's guidance end-to-end (ran the skill on a fresh Vite app, built it, drove it in a real browser). The docs are accurate and the skill generates good code — but it produces an app that crashes at runtime on Vite and Remix. The blocker is in the library, not this PR, but merging this PR ships guidance that walks users straight into it. Filed as TurboDocx/html-to-docx#218. What breaks
The trap: the build passes green. The failure only appears when a user clicks the button in the browser. Verified in Chromium — no Blob, no download. Why this PR specifically is affectedThis PR documents zero-config browser imports and adds Vite (eval 24) and Remix (eval 26) client-side evals — the two bundlers that break. The evals pass anyway because they assert on the generated source text ( Their own What needs to happen first
Not blockers, but worth a look while it's open
What's genuinely good here (for the record)A fresh agent given only this skill produced: a plain |
What & why
Updates the
turbodocx-html-to-docxskill to match the new browser packaging in@turbodocx/html-to-docx(see TurboDocx/html-to-docx#205): a browser-targeted ESM build (dist/html-to-docx.browser.esm.js) plus anexportsmap, so a plainimport HTMLtoDOCX from "@turbodocx/html-to-docx"works in any bundler (Next.js/Turbopack, Vite, webpack) with zero config — no alias, noBuffer/processpolyfills.Changes (
skills/turbodocx-html-to-docx)references/usage.md:dist/html-to-docx.browser.esm.js); corrected sizes (~1.6 MB across the board; the IIFE is ~1.6 MB minified, not ~2.4 MB).exportsmap (browser/node/import/require conditions) so consumers don't pick a build manually.import()code-splitting note and points to the runnableexample/nextjs-example.URL.revokeObjectURLtiming (revoke on next tick) in both Path 1 and Path 2 snippets.SKILL.md: intro + "prefer server-side" note updated (exports map, ~1.6 MB); browser-only path size corrected; skillversion→ 1.3.0.Testing (skill-creator eval)
Ran the skill against fresh projects (with the updated skill vs the v1.2.0 snapshot):
POST /generate→ .docx)tscclean. No regression from the browser-doc edits.vite buildsucceeded zero-config (1.69 MB split chunk, default export preserved).Note surfaced by the eval: on current v1.21.0 (pre-#205), Vite resolves the self-contained IIFE via the legacy
browserfield and still works — so the guidance is safe today and becomes mechanism-accurate once #205 ships.Draft for review.
🤖 Generated with Claude Code