ffmpegwasm / ffmpeg.wasm

FFmpeg for browser, powered by WebAssembly
https://ffmpegwasm.netlify.app
MIT License
14.01k stars 816 forks source link

0.12.1 - Vite local development 504 error .vite/deps/worker.js?type=module&worker_file #523

Closed iongion closed 1 year ago

iongion commented 1 year ago

Describe the bug

Using 0.12.1 - in a vite react browser application

This throws a 504

https://localhost:5173/node_modules/.vite/deps/worker.js?type=module&worker_file

image

To Reproduce

Steps to reproduce the behavior:

  1. Create a vite react app
  2. Call await ffmpeg.load(opts);

Expected behavior Library should load

Screenshots Attached

Desktop (please complete the following information):

Additional context Tried to exemplify in a code sanbox https://codesandbox.io/p/sandbox/hopeful-ptolemy-j5cjpn but the sandbox has some issues

JanMisker commented 1 year ago

I had the same and fixed it by adding this to defineConfig in vite.config.ts

 optimizeDeps: {
    exclude: ["@ffmpeg/ffmpeg", "@ffmpeg/util"],
  },
jeromewu commented 1 year ago

Yeah, I think optimizeDeps.exclude is a great solution! Will add it to the doc when possible.

teetow commented 1 year ago

This helped unblock me. Cheers!

zeh commented 1 year ago

Unf, thanks SO MUCH for this @JanMisker. Was scratching my heads for days on this one.

iongion commented 1 year ago

Awesome, this solved it, wiki notes updates