Commit 7ed10efd authored by Chunchi Che's avatar Chunchi Che

succeed in integrating wasm

parent 507f5eab
Pipeline #20646 failed with stages
in 5 minutes and 45 seconds
......@@ -31,6 +31,7 @@
"react-redux": "^8.0.4",
"react-router-dom": "^6.4.0",
"react-scripts": "^2.1.3",
"rust-src": "file:rust-src/pkg",
"socket.io-client": "^4.5.1",
"sql.js": "^1.8.0",
"vite-plugin-svgr": "^2.4.0",
......@@ -22770,6 +22771,10 @@
"aproba": "^1.1.1"
}
},
"node_modules/rust-src": {
"resolved": "rust-src/pkg",
"link": true
},
"node_modules/rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
......@@ -27133,6 +27138,9 @@
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"rust-src/pkg": {
"version": "0.1.0"
}
},
"dependencies": {
......@@ -44511,6 +44519,9 @@
"aproba": "^1.1.1"
}
},
"rust-src": {
"version": "file:rust-src/pkg"
},
"rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
......@@ -30,15 +30,17 @@
"sql.js": "^1.8.0",
"vite-plugin-svgr": "^2.4.0",
"web-vitals": "^2.1.4",
"ygopro-deck-encode": "^1.0.3"
"ygopro-deck-encode": "^1.0.3",
"rust-src": "file:rust-src/pkg"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build && cp -r neos-assets dist/",
"build:prod": "tsc && vite build --base=https://cdn02.moecube.com:444/neos/",
"wasm": "cd rust-src && wasm-pack build",
"dev": "npm run wasm && vite",
"build": "npm run wasm && tsc && vite build && cp -r neos-assets dist/",
"build:prod": "npm run wasm && tsc && vite build --base=https://cdn02.moecube.com:444/neos/",
"preview": "vite preview",
"lint": "eslint --ext .ts --ext .tsx src",
"fmt": "eslint --ext .ts --ext .tsx src --fix",
"fmt": "eslint --ext .ts --ext .tsx src --fix && cd rust-src && cargo fmt",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
......
......@@ -9,7 +9,7 @@ use wasm_bindgen::prelude::*;
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[wasm_bindgen]
extern {
extern "C" {
fn alert(s: &str);
}
......
import React, { Suspense } from "react";
import { Routes, Route } from "react-router-dom";
import LazyLoad, { Loading } from "./LazyLoad";
import { greet } from "rust-src";
const Login = React.lazy(() => import("./Login"));
const WaitRoom = React.lazy(() => import("./WaitRoom"));
......@@ -8,6 +9,8 @@ const Mora = React.lazy(() => import("./Mora"));
const NeosDuel = React.lazy(() => import("./Duel/main"));
export default function () {
greet();
return (
<Routes>
<Route path="/" element={<LazyLoad lazy={<Login />} />} />
......
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import svgr from 'vite-plugin-svgr'
import wasm from "vite-plugin-wasm";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), svgr()]
plugins: [react(), svgr(), wasm()]
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment