twgl.js: import syntax is broken
import twgl from 'twgl.js' returns undefined.
Related: https://github.com/greggman/twgl.js/issues/7 https://github.com/greggman/twgl.js/issues/108
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (5 by maintainers)
I spent all weekend chasing what turned out to be a kernel bug in the new 5.x kernel which totally took down my PC, so I’ll try to tackle it again this weekend.
@Elvynia my apologies, this completely slipped my mind. I’ll get to it this weekend definitely.
Ok, when I get time next weekend I’ll PR a rollup config that should maintain backwards compatibility with existing formats while providing module support and we’ll go from there.
Let me add when I original started this project bower was still a thing. People used pre-made ready to use
<script>based client side libraries. babel was not a thing. Webpack / rollup / parcel were not things.I’m all for supporting modules but I’m not so much for breaking older stuff
Yeah, I did something similar, symlinking
twgl’s/srcdirectory into an external lib folder and just foldingm4.jsinto my internal lib.@greggman I don’t mind doing a PR that overhauls your whole build system if you’re not too opinionated as long as it works correctly.
I’ve experienced the same problem while trying to write some TypeScript code.
In ‘modules’ example, TWGL is imported from
/src, so current workaround can be either cloning the whole/srcdirectory or doing some Rollup:This creates
twgl-full-module.jsfile which can be minified/imported/etc and used like this: