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

Examples: Use ESM version of lottie. #24763

Merged
merged 1 commit into from
Oct 10, 2022
Merged

Examples: Use ESM version of lottie. #24763

merged 1 commit into from
Oct 10, 2022

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Oct 9, 2022

Fixed #24762.

Description

Uses the ESM version of lottie.

@Mugen87 Mugen87 added this to the r146 milestone Oct 9, 2022
@Mugen87
Copy link
Collaborator Author

Mugen87 commented Oct 10, 2022

Note: I have deleted examples/js/libs/lottie_canvas.js since the ESM version adds bodymovin to the window object for backwards compatibility. So examples/js users have to include the ESM version, too. Apart from that, they have to define the global lottie variable like so: const lottie = bodymovin; before using the loader. bodymovin is no explicit export of the lottie module.

@Mugen87 Mugen87 merged commit 3265fc9 into mrdoob:dev Oct 10, 2022
@elalish
Copy link
Contributor

elalish commented Nov 9, 2022

I'm new to dynamic imports, but I'm trying to dynamically load lottie_canvas since it's huge. Three.js is bundled into model-viewer.js, but if I do a regular import of LottieLoader.js, then lottie_canvas gets bundled too. If I try to dynamically load LottieLoader, then it errors with TypeError: Failed to resolve module specifier "three".

Does this need to be updated to the system that e.g. DRACOLoader uses? Or is there a way to make this work as is?

@mrdoob
Copy link
Owner

mrdoob commented Nov 11, 2022

Does this need to be updated to the system that e.g. DRACOLoader uses?

That may be best yes!

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.

[plugin vite:dep-scan] Missing "./examples/js/libs/lottie_canvas.js" export in "three" package
3 participants