diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-11-07 22:01:43 +0100 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-11-07 22:01:43 +0100 |
commit | 5c20f19c8aee925f24e80bea9f3c2198a47b14a9 (patch) | |
tree | 3be4d3f33706adef55420db895034cb7584e2483 | |
parent | 06fa72fe1cb542823ccf1b5847ff55dd5d47903a (diff) | |
download | planetwars.dev-5c20f19c8aee925f24e80bea9f3c2198a47b14a9.tar.xz planetwars.dev-5c20f19c8aee925f24e80bea9f3c2198a47b14a9.zip |
use native vite features for including wasm
-rw-r--r-- | web/pw-server/package.json | 3 | ||||
-rw-r--r-- | web/pw-server/src/lib/components/Visualizer.svelte | 3 | ||||
-rw-r--r-- | web/pw-server/svelte.config.js | 2 |
3 files changed, 3 insertions, 5 deletions
diff --git a/web/pw-server/package.json b/web/pw-server/package.json index 25356f5..e8ade9f 100644 --- a/web/pw-server/package.json +++ b/web/pw-server/package.json @@ -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", diff --git a/web/pw-server/src/lib/components/Visualizer.svelte b/web/pw-server/src/lib/components/Visualizer.svelte index 4fe8ab4..eac1c52 100644 --- a/web/pw-server/src/lib/components/Visualizer.svelte +++ b/web/pw-server/src/lib/components/Visualizer.svelte @@ -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; diff --git a/web/pw-server/svelte.config.js b/web/pw-server/svelte.config.js index 02b4db9..769665b 100644 --- a/web/pw-server/svelte.config.js +++ b/web/pw-server/svelte.config.js @@ -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, }), |