forked from forks/ffprobe-wasm-npm
fix: make vite 7 compliant
Signed-off-by: Alix von Schirp <github@avonschirp.bootmedia.de>
This commit is contained in:
2
build.sh
2
build.sh
@@ -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
|
||||||
|
|||||||
@@ -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" });
|
|
||||||
}
|
|
||||||
@@ -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}`;
|
|
||||||
// // }
|
|
||||||
// // });
|
|
||||||
// // },
|
|
||||||
// // },
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user