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

Every new release breaks deployed apps #82

Open
gyzerok opened this issue Dec 16, 2024 · 13 comments
Open

Every new release breaks deployed apps #82

gyzerok opened this issue Dec 16, 2024 · 13 comments
Assignees
Labels
infrastructure Dev infrastructure question/idea New concepts / questions / suggestions

Comments

@gyzerok
Copy link

gyzerok commented Dec 16, 2024

Hello there!

Every new release you are making is causing us breakage before we update to it. This is because you are pointing to the latest version in your code

const _wasmUrl = 'https://unpkg.com/@thorvg/lottie-player@latest/dist/thorvg-wasm.wasm';

The best solution would be of course to use local copy of the wasm file from node_modules, so projects do not depend on 3rd-party cdn and have reproducible builds. But even using appropriate version from unpkg would already go a long way.

Thank you!

@tinyjin
Copy link
Member

tinyjin commented Dec 18, 2024

@gyzerok Yes, we were aware of this point. That's why we introduce wasmUrl property #80. When using CDN, it'd be hard to ensure consistent loading time and reproducible builds as you mentioned.

The _wasmUrl should be fallback link, and users should be able to handle origin of WASM binary.
The update enabling custom WasmURL will soon be shipped. Would it be answer for you?

@gyzerok
Copy link
Author

gyzerok commented Dec 18, 2024

@tinyjin yeah, thank you! I'll wait for the next version, check that everything works with and will close the issue if so.

@gyzerok
Copy link
Author

gyzerok commented Dec 18, 2024

One thing though: it'd be nice if fallback would point to the concrete version from unpkg instead of always latest. Otherwise fallback will still break in production on releases.

@hermet hermet added question/idea New concepts / questions / suggestions infrastructure Dev infrastructure labels Dec 19, 2024
@tinyjin
Copy link
Member

tinyjin commented Dec 27, 2024

@gyzerok ThankPlz check this ;)

Custom WASM URL has just shipped to v1.0.0-pre.9

Web Component

<lottie-player
      autoPlay
      loop
      src="https://lottie.host/6d7dd6e2-ab92-4e98-826a-2f8430768886/NGnHQ6brWA.json"
      wasmUrl="/dist/thorvg-wasm.wasm"
      style="width: 300px; height: 300px"
></lottie-player>

JS-creation

player = document.createElement('lottie-player');
player.autoPlay = true;
player.loop = true;
player.wasmUrl = '/thorvg-wasm.wasm'; // Set Custom WASM URL
player.renderConfig = { renderer };

React/NextJS

bedd5c0

@tinyjin
Copy link
Member

tinyjin commented Dec 27, 2024

it'd be nice if fallback would point to the concrete version from unpkg instead of always latest. Otherwise fallback will still break in production on releases.

Agree, will fix it soon. You can follow up this issue.

@tinyjin tinyjin closed this as completed Dec 27, 2024
@github-project-automation github-project-automation bot moved this to Done 0.14 in ThorVG.Web Dec 27, 2024
@gyzerok
Copy link
Author

gyzerok commented Dec 27, 2024

@tinyjin when trying to import it with vite like so import wasmUrl from '@thorvg/lottie-player/dist/thorvg-wasm.wasm?url' I am getting Missing "./dist/thorvg-wasm.wasm" specifier in "@thorvg/lottie-player" package [plugin vite:dep-scan]

@gyzerok
Copy link
Author

gyzerok commented Dec 27, 2024

Seems like what you are missing is this in package.json:

  "exports": {
    ".": {
      "import": "./dist/lottie-player.cjs.js",
      "require": "./dist/lottie-player.esm.js"
    },
    "./dist/thorvg-wasm.wasm": {
      "import": "./dist/thorvg-wasm.wasm",
      "require": "./dist/thorvg-wasm.wasm"
    }
  },

@tinyjin
Copy link
Member

tinyjin commented Dec 27, 2024

@gyzerok
Can you try this?

import wasmUrl from "../node_modules/@thorvg/lottie-player/dist/thorvg-wasm.wasm"

I think WASM binary file doesn't have to be handled by module bundler. Thus that is easy way to go.

@gyzerok
Copy link
Author

gyzerok commented Dec 27, 2024

@tinyjin will try it out, but I think it does, because multiple deployments have to have different versions and vite adds content hash to the file during builds. This way there are no conflicts between versions of the wasm file. Otherwise the problem would be similar to pointing internally to the latest unpkg version

@gyzerok
Copy link
Author

gyzerok commented Dec 28, 2024

@tinyjin I've tried it and getting the same error. I think without the exports bit in package.json modern module system considers it "internal". I've checked also with adding exports and then it works

@gyzerok
Copy link
Author

gyzerok commented Jan 14, 2025

@tinyjin sorry for the ping, but it seems like you've missed my last comment

@tinyjin
Copy link
Member

tinyjin commented Jan 16, 2025

@gyzerok Sorry for being late. Thanks for letting us know!

We'll review and support WASM entry export : )

@gyzerok
Copy link
Author

gyzerok commented Jan 16, 2025

Awesome, thank you!

@hermet hermet reopened this Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Dev infrastructure question/idea New concepts / questions / suggestions
Projects
Status: Done 0.14
Development

No branches or pull requests

3 participants