Blog

Rollup watch mode: library bundles, CORS on demo HTML pages, and UMD versus IIFE globals

When you ship UMD builds consumed from third-party sites, your API must emit explicit CORS because the script origin differs from your API host.

1 min read
rolluplibrarycors

External dependencies

Mark peer dependencies as external in Rollup to avoid duplicating fetch polyfills that alter CORS behavior.

Dual ESM/CJS outputs should share the same API base URL resolution logic.

Source maps

Publish maps to a CDN with CORS enabled for browsers to unminify stack traces in consumer SPAs.

Private npm registries may wrap tarball URLs—verify Allow-Origin on those asset hosts too.

Back to blog