fix: make vite 7 compliant

Signed-off-by: Alix von Schirp <github@avonschirp.bootmedia.de>
This commit is contained in:
2026-02-19 20:38:55 +01:00
parent bc9e1670b2
commit 24a55c018f
3 changed files with 7 additions and 43 deletions

View File

@@ -12,8 +12,6 @@ cd ffprobe-wasm-app
docker-compose run ffprobe-wasm make docker-compose run ffprobe-wasm make
cd .. cd ..
cp -R ffprobe-wasm-app/dist dist cp -R ffprobe-wasm-app/dist dist
mv dist/ffprobe-wasm.js dist/ffprobe-wasm.mjs
node scripts/replace.js
cp src/*.d.* dist cp src/*.d.* dist
# Build browser/node workers # Build browser/node workers

View File

@@ -1,27 +0,0 @@
const { readFile, writeFile } = require("fs/promises");
const { dirname, resolve } = require("path");
main();
async function main() {
const root = dirname(__dirname);
const wasmJsPath = resolve(root, "dist/ffprobe-wasm.mjs");
let content = await readFile(wasmJsPath, { encoding: "utf8" });
content = `\
import initWasmInstance from "./ffprobe-wasm.wasm";
const initWasm = (info) =>
initWasmInstance(info).then((exports) => ({ instance: { exports } }));
${content}`;
content = content.replace(`import.meta.url`, `''`);
content = content.replace(
`instantiateAsync().catch(readyPromiseReject)`,
`initWasm(info).then(receiveInstantiatedSource, readyPromiseReject)`
);
await writeFile(wasmJsPath, content, { encoding: "utf8" });
}

View File

@@ -21,18 +21,11 @@ export default defineConfig({
wasm(), wasm(),
topLevelAwait() topLevelAwait()
], ],
// worker: { worker: {
// plugins: [ plugins: () => [
// // { wasm(),
// // name: "append-source-url", topLevelAwait(),
// // generateBundle(options, bundle) { ],
// // Object.entries(bundle).forEach(([file, output]) => { format: "es"
// // if (output.type === "chunk") { },
// // output.code += `\n//# sourceURL=${file}`;
// // }
// // });
// // },
// // },
// ],
// },
}); });