-
Notifications
You must be signed in to change notification settings - Fork 724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert to type "module" and use package exports #432
Conversation
I personally would prefer option one from the linked blog post. After all, gl-matrix is at the point where barely anything ever changes, which means that pointing people with old build tools to an older version of gl-matrix should be fine. We'd have to release a new major version of gl-matrix though. (updated the issue to reflect on this)
|
This is completely fine by me. The only caveat is that this not only requires newer versions of node, but to also be running Node with ESM files. Since TypeScript currently doesn't support outputting Node compatible ESM files (they do not include file extensions in import calls) the new gl-matrix wont be consumable through typescript in Node. This should not be a problem in frontend code though, which is the main use case of gl-matrix. |
Good to know about that limitation. I suppose this should be fine, like you've said. |
The project has now been converted to |
The Travis build seems to be using Node 12.16.1, which does not support ESM modules. All tests pass locally (in ^12.17, ^13.2 and >= 14). |
Feel free to bump up the Node version used in Travis Line 4 in 6f5c321
|
ok sorted, set it to latest LTS 14.17.0. |
should the common file be exposed in a export? for something like |
Yes please, do expose the common file. The toRadian and other methods are useful to have. |
done! i see now common is exported as |
Oh, if it's already being exposed as |
it's exposed in a little different way... today you can: import { glMatrix } from 'gl-matrix'
glMatrix.toRadian() with my change you can also: import { toRadian } from 'gl-matrix/common'
toRadian() i was wondering if i you think i should rename the named export |
I think it's currently fine with |
ok, then I'm feeling pretty done with this PR and it should be ready for merge! |
- All util and config files have been converted to ESM - Use file extensions in import calls spec files - Use Node 14.17.0 in Travis
Thank you! |
This PR uses
type: "module"
and package exports to fully support ESM in modern versions of Node.Closes #425