aboutsummaryrefslogtreecommitdiff
path: root/web/pw-frontend
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2021-12-23 18:22:14 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2021-12-23 18:22:14 +0100
commitc26f72890f934d654742328702661f0bd73b7582 (patch)
treecdd1fa595c1fce56ae1efbe2e3392045dd6c0bb0 /web/pw-frontend
parent96ee00242f350b391dcc1cf4d72a442c969f565e (diff)
downloadplanetwars.dev-c26f72890f934d654742328702661f0bd73b7582.tar.xz
planetwars.dev-c26f72890f934d654742328702661f0bd73b7582.zip
fix frontend build
Diffstat (limited to 'web/pw-frontend')
-rw-r--r--web/pw-frontend/package.json2
-rw-r--r--web/pw-frontend/src/main.ts9
-rw-r--r--web/pw-frontend/tsconfig.json2
-rw-r--r--web/pw-frontend/vite.config.js14
4 files changed, 19 insertions, 8 deletions
diff --git a/web/pw-frontend/package.json b/web/pw-frontend/package.json
index 194f7cf..d1c9c72 100644
--- a/web/pw-frontend/package.json
+++ b/web/pw-frontend/package.json
@@ -1,6 +1,6 @@
{
"name": "pw-frontend",
- "version": "0.0.0",
+ "version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/web/pw-frontend/src/main.ts b/web/pw-frontend/src/main.ts
index eb9e5a0..b9ec466 100644
--- a/web/pw-frontend/src/main.ts
+++ b/web/pw-frontend/src/main.ts
@@ -1,9 +1,10 @@
import App from './App.svelte'
-import load_wasm_module from "planetwars-rs";
+import init_wasm_module from "planetwars-rs";
-load_wasm_module().then(() => {
+const wasm_url = new URL("../planetwars-rs/pkg/planetwars_rs_bg.wasm", import.meta.url)
+
+init_wasm_module(wasm_url).then(() => {
const app = new App({
target: document.getElementById('app')
})
-});
-
+}) \ No newline at end of file
diff --git a/web/pw-frontend/tsconfig.json b/web/pw-frontend/tsconfig.json
index 2bfc2d3..e242fcf 100644
--- a/web/pw-frontend/tsconfig.json
+++ b/web/pw-frontend/tsconfig.json
@@ -3,7 +3,9 @@
"compilerOptions": {
"target": "esnext",
"useDefineForClassFields": true,
+ // "module": "esnext",
"module": "esnext",
+ "esModuleInterop": true,
"resolveJsonModule": true,
"baseUrl": ".",
diff --git a/web/pw-frontend/vite.config.js b/web/pw-frontend/vite.config.js
index 7682f94..bce1f51 100644
--- a/web/pw-frontend/vite.config.js
+++ b/web/pw-frontend/vite.config.js
@@ -1,12 +1,20 @@
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
-import nodePolyfills from 'rollup-plugin-polyfill-node'
-
+import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
svelte(),
- nodePolyfills()
+ viteCommonjs({
+ transformMixedEsModules: true,
+ }),
],
+ build: {
+ commonjsOptions: {
+ transformMixedEsModules: true,
+ },
+ minify: false,
+ target: "modules",
+ },
})