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

I updated to next.js 15 and got an error. #793

Open
agent-Y opened this issue Nov 11, 2024 · 8 comments
Open

I updated to next.js 15 and got an error. #793

agent-Y opened this issue Nov 11, 2024 · 8 comments

Comments

@agent-Y
Copy link

agent-Y commented Nov 11, 2024

I get error at await ffmpeg.load();

Build Error
Next.js (15.0.1) out of date (learn more) (Turbopack)
Failed to compile

./node_modules/@ffmpeg/ffmpeg/dist/esm/classes.js:104:28
Module not found
  102 |         if (!this.#worker) {
  103 |             this.#worker = classWorkerURL ?
> 104 |                 new Worker(new URL(classWorkerURL, import.meta.url), {
      |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  105 |                     type: "module",
  106 |                 }) :
  107 |                 // We need to duplicated the code here to enable webpack

https://nextjs.org/docs/messages/module-not-found
This error occurred during the build process and can only be dismissed by fixing the error.
@mrblackoutz
Copy link

I’m experiencing the same issue here. It was already mentioned in this issue: #72397.

@interactda
Copy link

Is there anyway to work around this?

@jswhisperer
Copy link
Contributor

Haven't tested but looks like you need to declare ffmpeg as an external so it doesn't get bundled twice
https://webpack.js.org/configuration/externals/

@interactda
Copy link

Haven't tested but looks like you need to declare ffmpeg as an external so it doesn't get bundled twice https://webpack.js.org/configuration/externals/

I think the issue is with turbopack rather than webpack

@jswhisperer
Copy link
Contributor

@484Irgang
Copy link

484Irgang commented Jan 20, 2025

Same issue here. Unfortunately, setting this package as serverExternalPackage in next.config does not resolve the problem. I'm still encountering the following error:

./node_modules/@ffmpeg/ffmpeg/dist/esm/classes.js:104:28
Module not found: Can't resolve "< dynamic >"
102 | if (!this.#worker) {
103 | this.#worker = classWorkerURL ?
104 | new Worker(new URL(classWorkerURL, import.meta.url), {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105 | type: "module",
106 | }) :
107 | // We need to duplicate the code here to enable webpack

As mentioned in this comment, it seems that import.meta.url is causing compatibility issues with Turbopack.

@TexLuciano
Copy link

Error: ffmpeg.wasm does not support nodejs
at new FFmpeg (file:///C:/br-contant/bear4/node_modules/@ffmpeg/ffmpeg/dist/esm/empty.mjs:4:15)
at C:\br-contant\bear4.next\server\chunks\ssr[root of the server]__854184._.js:755:24

I try use external import but not working someone resolve this issue?

@asp3
Copy link

asp3 commented Feb 18, 2025

If anyone runs into this, you can fix this by just turning off ffmpeg in dev mode

    /**
     * Loads ffmpeg-core inside web worker. It is required to call this method first
     * as it initializes WebAssembly and other essential variables.
     *
     * @category FFmpeg
     * @returns `true` if ffmpeg core is loaded for the first time.
     */
    load = ({ classWorkerURL, ...config } = {}, { signal } = {}) => {
        if (process.env.APP_ENV === "local") {
            return Promise.resolve(true);
        }

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

7 participants