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

ReferenceError: __dirname is not defined #1283

Open
3 tasks done
Stadly opened this issue Jun 25, 2024 · 0 comments
Open
3 tasks done

ReferenceError: __dirname is not defined #1283

Stadly opened this issue Jun 25, 2024 · 0 comments

Comments

@Stadly
Copy link

Stadly commented Jun 25, 2024

I cannot use fluent-ffmpeg in the production build of my SvelteKit app. It works in dev mode, and also in preview mode, but in the final production build, any call to ffmpeg results in a ReferenceError: __dirname is not defined. I guess it is an issue with ESM vs CommonJS.

Version information

  • fluent-ffmpeg version: 2.1.3
  • ffmpeg version: 5.1.5
  • OS: Alpine Linux (Windows Subsystem for Linux)

Code to reproduce

import ffmpeg from "fluent-ffmpeg";
ffmpeg();

(note: if the problem only happens with some inputs, include a link to such an input file)

Expected results

No errors

Observed results

ReferenceError: __dirname is not defined
    at new FfmpegCommand (file:///app/build/server/chunks/index-D6fKiITG.js:5210:69)
    at FfmpegCommand (file:///app/build/server/chunks/index-D6fKiITG.js:5178:13)
    at file:///app/build/server/chunks/0-DGpjmR_G.js:15:8
    at file:///app/build/server/chunks/server-DbC9RgP-.js:13:32
    at load_server_data (file:///app/build/server/chunks/index-B8KRwtQw.js:1464:42)
    at file:///app/build/server/chunks/index-B8KRwtQw.js:2947:24

Checklist

  • I have read the FAQ
  • I tried the same with command line ffmpeg and it works correctly (hint: if the problem also happens this way, this is an ffmpeg problem and you're not reporting it to the right place)
  • I have included full stderr/stdout output from ffmpeg
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

No branches or pull requests

1 participant