-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I'm getting this error "Error: Error: Cannot find module '@ffmpeg.wasm/core-mt', When my code is deployed on Vercel (Node.js + TypeScript) Does I get confused because when I try to run the same code on my local machine it works fine
But as I deploy it on Vercel it gives that error. Obviously, i do have "@ffmpeg.wasm/core-mt" installed as said in the package https://github.com/FFmpeg-wasm/FFmpeg.wasm#installation So how do I fix it?
I'm currently using it like this
import { FFmpeg } from "@ffmpeg.wasm/main";
async function myFunction() {
const ffmpeg = await FFmpeg.create({
core: "@ffmpeg.wasm/core-mt",
log: true,
});
}
However, in the docs, i see doing like this
import { FFmpeg } from "@ffmpeg.wasm/main";
const ffmpeg = await FFmpeg.create({
core: "@ffmpeg.wasm/core-mt",
log: true,
});
async function myFunction() {
// use ffmpeg here
}
But then i start getting errors like "top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."
I tried a couple of StackOverflow solutions but nothing works in my case. So what should I do?
tsconfig.json:
{
"compilerOptions": {
"module": "CommonJS",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"noImplicitAny": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {
"*": ["node_modules/*", "src/types/*"]
}
},
"include": ["./src/**/*", "src/firebase/serviceAccountKey.ts"]
}