Skip to content
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

add es module of gltf/library.js #567

Closed
wants to merge 4 commits into from
Closed

add es module of gltf/library.js #567

wants to merge 4 commits into from

Conversation

1d10t
Copy link
Contributor

@1d10t 1d10t commented Jun 15, 2023

usage: import * as gltfpack from 'path/to/module.js'

@zeux
Copy link
Owner

zeux commented Oct 7, 2023

I forgot to comment on this, but this is a little stuck due to node.js only having ES module support in recent versions. I'm not sure if there's a way to refactor this code so that we can have a module that can be imported but still have most of the code in the same file... and I don't think I want to maintain the duplicate JS files here.

Maybe an alternative is to have some simple prepublish step that builds the module.js file from library.js before creating the package, as long as this doesn't introduce new build time dependencies (aka runs in pure node).

@zeux
Copy link
Owner

zeux commented Aug 27, 2024

I'm going to close this because I don't want to maintain two versions here so I can't merge this as is. Looking at the node.js support for ESM I would be happy to accept a change that just switches library.js to a module (fine to keep the file name); my understanding is that this requires a change in package.json to make node recognize it as a module, and should be compatible with Node 12 and later versions.

@zeux zeux closed this Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants