motion-canvas
motion-canvas copied to clipboard
UMD Build
Description Add a UMD build for loading via CDN (like unpkg).
I'm working on building a fiddle site (Discord Thread), and while I can include one version of the package in the scripts I distribute, I'd much prefer to load it via CDN so that I can have a library version picker.
Proposed solution Ideally we'd use something like Rollup or Webpack to build a version of the package that's ready for UMD import.
Let's use Rollup since that's what Vite in other packages uses
I'm going to try to learn about and tackle this.
#710 introduced ES bundles and #712 made use of them in the fiddle editor on our documentation website.
After doing some research, it seems that UMD bundles are a thing of the past. (Here's three.js getting rid of them for example https://github.com/mrdoob/three.js/pull/25435) The support for ES modules in both browsers and Node.js has been there for a very long time and so I don't think there are any reasons to distribute a UMD bundle.
Note that you will (in v4) be able to use these ES bundles via CDN:
import {all, createRef} from 'https://esm.sh/@motion-canvas/core';
import {makeScene2D, Circle} from 'https://esm.sh/@motion-canvas/2d';
// ...