jonobr1 / two.js

A renderer agnostic two-dimensional drawing api for the web.
https://two.js.org
MIT License
8.29k stars 454 forks source link

Two.js Fails to Load In Node Environments #643

Closed jonobr1 closed 2 years ago

jonobr1 commented 2 years ago

Describe the bug Originally found here. Since porting the build processes to esbuild, Two.js has been unable to load in commonjs environments.

To Reproduce Steps to reproduce the behavior: Try to import Two.js in a Node environment (not ES6) via:

const Two = require('two.js');

Expected behavior Two.js is loaded. But, the result is actually this:

Uncaught (in promise) TypeError: Two is not a constructor
    at sketch (sketch.js? [sm]:11:1)
    at SketchManager.js:967:20

Environment (please select one):

jonobr1 commented 2 years ago

Fixed and published to v0.8.10