use native vite features for including wasm

This commit is contained in:
Ilion Beyst 2022-11-07 22:01:43 +01:00
parent 06fa72fe1c
commit 5c20f19c8a
3 changed files with 3 additions and 5 deletions

View file

@ -31,8 +31,7 @@
"svelte-preprocess": "^4.9.4",
"tslib": "^2.3.1",
"typescript": "^4.4.3",
"vite-plugin-iso-import": "^0.1.3",
"vite-plugin-wasm-pack": "^0.1.9"
"vite-plugin-iso-import": "^0.1.3"
},
"dependencies": {
"@fortawesome/free-solid-svg-icons": "^6.2.0",

View file

@ -2,6 +2,7 @@
import { onDestroy, onMount } from "svelte";
import * as visualizer from "pw-visualizer";
import init_wasm_module from "planetwars-rs";
import planetwars_wasm_module from "planetwars-rs/planetwars_rs_bg.wasm?url";
import { PLAYER_COLORS } from "$lib/constants";
export let matchLog = null;
@ -10,7 +11,7 @@
let initialized = false;
onMount(async () => {
await init_wasm_module();
await init_wasm_module(planetwars_wasm_module);
visualizer.init();
initialized = true;

View file

@ -1,7 +1,6 @@
import adapter from "@sveltejs/adapter-node";
import sveltePreprocess from "svelte-preprocess";
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
import wasmPack from "vite-plugin-wasm-pack";
import { isoImport } from "vite-plugin-iso-import";
import { mdsvex } from "mdsvex";
@ -27,7 +26,6 @@ const config = {
vite: {
plugins: [
isoImport(),
wasmPack([], ["planetwars-rs"]),
viteCommonjs({
transformMixedEsModules: true,
}),