motion-canvas icon indicating copy to clipboard operation
motion-canvas copied to clipboard

UMD Build

Open hhenrichsen opened this issue 2 years ago • 2 comments

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.

hhenrichsen avatar Feb 10 '23 15:02 hhenrichsen

Let's use Rollup since that's what Vite in other packages uses

aarthificial avatar Feb 10 '23 16:02 aarthificial

I'm going to try to learn about and tackle this.

hhenrichsen avatar Feb 10 '23 20:02 hhenrichsen

#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';

// ...

aarthificial avatar May 23 '23 09:05 aarthificial