ESM works in modern browsers and server runtimes, including Node.js, Deno, and Bun. It's tempting to export a single default object literal with more than one property-addressed function rather than use individual exportdeclarations. Browsers without ESM support will not load scripts with a nomodule attribute. The CORS header must be set when a module can be imported from another domain. A CommonJS module makes a function or value.

8m read timeFrom blog.openreplay.com
Post cover image
Table of contents
Using ES2015 Modules (ESM)Loading ES Modules in BrowsersOpen Source Session ReplayUsing CommonJS Modules in Node.jsDifferences Between ES Modules and CommonJSConclusion
1 Comment

Sort: