Skip to content

docs: add browser bundling guide - #7289

Open
rajanpanth wants to merge 2 commits into
denoland:mainfrom
rajanpanth:docs/browser-bundling-guide
Open

docs: add browser bundling guide#7289
rajanpanth wants to merge 2 commits into
denoland:mainfrom
rajanpanth:docs/browser-bundling-guide

Conversation

@rajanpanth

Copy link
Copy Markdown

Summary

  • document how to bundle JSR-published Standard Library TypeScript for browsers
  • use the recommended esbuild-deno-loader integration with a complete entry point and build script
  • explain browser-compatibility declarations and deno.json import-map discovery

Closes #4586

Validation

  • deno fmt --check README.md
  • ran the documented example with Deno 2.9.5 and confirmed esbuild generated dist/main.js
  • git diff --check

@CLAassistant

CLAassistant commented Aug 16, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@tomas-zijdemans tomas-zijdemans left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for picking this up, #4586 sat open for a long time. A few suggestions from me:

  • CI is red: deno task test type-checks ts fences in markdown too. Mark both snippets ```ts ignore (FAQ.md has the convention).
  • Prefer deno bundle --platform browser -o dist/main.js main.ts as the primary path. @kt3k suggested the loader before deno bundle returned in 2.4.
  • Swap the base64 example. encodeBase64 is most likely on its way out of std now that Uint8Array.fromBase64 exists. You could use something from @std/text or @std/html instead.
  • The deno.json note is off: the loader resolves config from cwd or an explicit configPath, not the entry point. Moot if you switch to deno bundle.
  • nit: await esbuild.stop().

@rajanpanth

Copy link
Copy Markdown
Author

Thanks for the detailed review. I updated the guide to:

  • use deno bundle --platform browser -o dist/main.js main.ts as the primary path
  • mark both TypeScript snippets as ts ignore for markdown type-checking
  • replace the base64 example with @std/html/entities
  • remove the incorrect deno.json loader discovery note
  • change the esbuild example to await esbuild.stop()

I also ran git diff --check locally. I could not run deno task test on this machine because deno is not available on PATH here, so I’ll watch CI for the updated commit.

@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.03%. Comparing base (ca58f94) to head (cfa73c8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7289   +/-   ##
=======================================
  Coverage   95.03%   95.03%           
=======================================
  Files         617      617           
  Lines       51637    51637           
  Branches     9359     9359           
=======================================
  Hits        49075    49075           
  Misses       2021     2021           
  Partials      541      541           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

suggestion: add guide on how to use the Standard Library in the browser

3 participants