fix: add vite plugins for wasm

Signed-off-by: Alix von Schirp <github@avonschirp.bootmedia.de>
This commit is contained in:
2026-02-19 13:44:55 +01:00
parent c0e13cdaa1
commit bc9e1670b2
3 changed files with 461 additions and 16 deletions

View File

@@ -1,5 +1,7 @@
import { resolve } from "path";
import { defineConfig } from "vite";
import topLevelAwait from "vite-plugin-top-level-await";
import wasm from "vite-plugin-wasm";
// https://vitejs.dev/config/
export default defineConfig({
@@ -14,18 +16,23 @@ export default defineConfig({
minify: false,
sourcemap: true,
},
worker: {
plugins: [
{
name: "append-source-url",
generateBundle(options, bundle) {
Object.entries(bundle).forEach(([file, output]) => {
if (output.type === "chunk") {
output.code += `\n//# sourceURL=${file}`;
}
});
},
},
],
},
plugins: [
wasm(),
topLevelAwait()
],
// worker: {
// plugins: [
// // {
// // name: "append-source-url",
// // generateBundle(options, bundle) {
// // Object.entries(bundle).forEach(([file, output]) => {
// // if (output.type === "chunk") {
// // output.code += `\n//# sourceURL=${file}`;
// // }
// // });
// // },
// // },
// ],
// },
});