Skip to content

feat(umd): add UMD bundle for CDN/<script> use (src/index.ts)#98

Open
paulpach wants to merge 2 commits into
akonan:mainfrom
paulpach:feat/umd-bundle-cdn
Open

feat(umd): add UMD bundle for CDN/<script> use (src/index.ts)#98
paulpach wants to merge 2 commits into
akonan:mainfrom
paulpach:feat/umd-bundle-cdn

Conversation

@paulpach

Copy link
Copy Markdown

Summary

Follow-up to #75 and the suggestion in #95's closing comment.

Adds a UMD bundle targeted at src/index.ts (the existing public entry point) so CDN / <script> consumers who don't run a bundler can use wiremd without any build tooling.

What changed

File Change
vite.config.browser.ts New config — UMD-only build from src/index.ts, all deps inlined, minified with terser
package.json Two new scripts: build:umd and dev:umd

No new subpath export (wiremd/browser) is added — that's intentional. The UMD file lives in dist/wiremd.umd.js and is already covered by the existing "files": ["dist"] entry.

Output

dist/wiremd.umd.js  228 kB │ gzip: 53 kB

Usage (CDN)

<script src="https://unpkg.com/wiremd/dist/wiremd.umd.js"></script>
<script>
  const ast = wiremd.parse('# Hello\n[Button]');
  const html = wiremd.renderToHTML(ast);
  document.body.innerHTML = html;
</script>

Notes

paulpach and others added 2 commits May 11, 2026 11:15
Adds vite.config.browser.ts that produces dist/wiremd.umd.js from the
existing src/index.ts entry point (no parallel browser.ts needed).

- Entry: src/index.ts (parser + renderer core, no CLI)
- Format: UMD only (global name: wiremd)
- All npm deps inlined; no Node.js built-ins required by core
- Source map included, minified with terser
- Output: ~229 kB / ~53 kB gzipped

New scripts:
  npm run build:umd   — one-off UMD build
  npm run dev:umd     — watch mode for local development

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@paulpach

Copy link
Copy Markdown
Author

@akonan as you requested

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.

1 participant