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

[Bug]: "asset/resource" module used to handle ".lottie"-animations works in dev-mode but breaks animation-file in production mode #5656

Closed
fredrik-lindqvist opened this issue Feb 15, 2024 · 7 comments · Fixed by #5726
Assignees
Labels
bug Something isn't working upstream

Comments

@fredrik-lindqvist
Copy link

fredrik-lindqvist commented Feb 15, 2024

System Info

System:
OS: macOS 14.2.1,
CPU: Apple M2 pro
Memory: 16gb
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.10.0
npm: 10.2.3
Browsers:
Chrome 121.0.6167.160
Safari 17.2.1
npmPackages:
@rspack/cli: 0.5.4
@rspack/core: 0.5.4
@dotlottie/player-component: 1.3.2
react: 18.2.0
react-dom: 18.2.0

Details

To handle import of animations (".lottie"-files ) in my app i use builtin "asset/resource" module. This works great in development mode and all animations are imported correctly. However when I switch to production mode, all imported animations break and can not be loaded correctly. If i switch to webpack 5 (version 5.89.0) all files are loaded correctly in both production and development mode.

Reproduce link

No response

Reproduce Steps

  1. setup "asset/resource" to handle ".lottie" files in rspack.config
  2. set mode to "production" in rspack.config
  3. import a ".dotlottie"-file to dot-lottie-player from @dotlottie/player-component
  4. animation wont work
  5. switch to development mode in rspack.config
  6. animation will work
@fredrik-lindqvist fredrik-lindqvist added bug Something isn't working pending triage The issue/PR is currently untouched. labels Feb 15, 2024
@fredrik-lindqvist
Copy link
Author

just downgraded to version 0.5.1 for @rspack/cli and @rspack/core: and then all dotLottie-animations work great in dev and production mode. Also tried version 0.5.2 and then the files break in production. Seems that the files loses their mimetype.

@jerrykingxyz jerrykingxyz removed the pending triage The issue/PR is currently untouched. label Feb 19, 2024
@magic-akari
Copy link
Contributor

Same issue.

I attempted to address the issue by replacing the JSON path loading method with an inline JSON object(animationData), but the problem persisted. Therefore, I speculate that this issue is unrelated to the assets loader.

@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Feb 20, 2024

@fredrik-lindqvist Sorry I'm not able to reproduce. Would you please provide a minimal repo?

Copy link
Contributor

Hello @fredrik-lindqvist, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by need reproduction will be closed if no activities in 14 days.

@h-a-n-a h-a-n-a added the pending triage The issue/PR is currently untouched. label Feb 20, 2024
@magic-akari
Copy link
Contributor

magic-akari commented Feb 20, 2024

Here is a minimal reproduction.
This issue is related to optimization.minimize.
rspack-lottie-1.0.0.tgz

@fredrik-lindqvist
Copy link
Author

@magic-akari thanks for the repo. @h-a-n-a see comment above.

@xc2
Copy link
Collaborator

xc2 commented Feb 20, 2024

thanks @magic-akari

it seems a swc_ecma_minifier related bug, and i've created an issue for this case.

swc-project/swc#8651

please help with it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants