use native vite features for including wasm
This commit is contained in:
parent
06fa72fe1c
commit
5c20f19c8a
3 changed files with 3 additions and 5 deletions
|
@ -31,8 +31,7 @@
|
||||||
"svelte-preprocess": "^4.9.4",
|
"svelte-preprocess": "^4.9.4",
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1",
|
||||||
"typescript": "^4.4.3",
|
"typescript": "^4.4.3",
|
||||||
"vite-plugin-iso-import": "^0.1.3",
|
"vite-plugin-iso-import": "^0.1.3"
|
||||||
"vite-plugin-wasm-pack": "^0.1.9"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.2.0",
|
"@fortawesome/free-solid-svg-icons": "^6.2.0",
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { onDestroy, onMount } from "svelte";
|
import { onDestroy, onMount } from "svelte";
|
||||||
import * as visualizer from "pw-visualizer";
|
import * as visualizer from "pw-visualizer";
|
||||||
import init_wasm_module from "planetwars-rs";
|
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";
|
import { PLAYER_COLORS } from "$lib/constants";
|
||||||
|
|
||||||
export let matchLog = null;
|
export let matchLog = null;
|
||||||
|
@ -10,7 +11,7 @@
|
||||||
let initialized = false;
|
let initialized = false;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await init_wasm_module();
|
await init_wasm_module(planetwars_wasm_module);
|
||||||
|
|
||||||
visualizer.init();
|
visualizer.init();
|
||||||
initialized = true;
|
initialized = true;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import adapter from "@sveltejs/adapter-node";
|
import adapter from "@sveltejs/adapter-node";
|
||||||
import sveltePreprocess from "svelte-preprocess";
|
import sveltePreprocess from "svelte-preprocess";
|
||||||
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
|
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
|
||||||
import wasmPack from "vite-plugin-wasm-pack";
|
|
||||||
import { isoImport } from "vite-plugin-iso-import";
|
import { isoImport } from "vite-plugin-iso-import";
|
||||||
import { mdsvex } from "mdsvex";
|
import { mdsvex } from "mdsvex";
|
||||||
|
|
||||||
|
@ -27,7 +26,6 @@ const config = {
|
||||||
vite: {
|
vite: {
|
||||||
plugins: [
|
plugins: [
|
||||||
isoImport(),
|
isoImport(),
|
||||||
wasmPack([], ["planetwars-rs"]),
|
|
||||||
viteCommonjs({
|
viteCommonjs({
|
||||||
transformMixedEsModules: true,
|
transformMixedEsModules: true,
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in a new issue