Skip to content

Commit 0456893

Browse files
committed
dev: add emulator prod deployment
1 parent f2acd83 commit 0456893

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/emulator/src/main.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
"use strict";
22

3+
console.log(`emulator running in mode: ${MODE}`)
4+
5+
const PATH_V86 = MODE === 'dev' ? '/vendor/v86' : './vendor/v86';
6+
37
const { XDocumentPTT } = require("../../phoenix/src/pty/XDocumentPTT");
48
const {
59
NewWispPacketStream,
@@ -132,15 +136,15 @@ window.onload = async function()
132136
);
133137
const arrayBuffer = await resp.arrayBuffer();
134138
var emulator = window.emulator = new V86({
135-
wasm_path: "/vendor/v86/v86.wasm",
139+
wasm_path: PATH_V86 + "/v86.wasm",
136140
memory_size: 512 * 1024 * 1024,
137141
vga_memory_size: 2 * 1024 * 1024,
138142
screen_container: document.getElementById("screen_container"),
139143
bios: {
140-
url: "/vendor/v86/bios/seabios.bin",
144+
url: PATH_V86 + "/bios/seabios.bin",
141145
},
142146
vga_bios: {
143-
url: "/vendor/v86/bios/vgabios.bin",
147+
url: PATH_V86 + "/bios/vgabios.bin",
144148
},
145149

146150
initrd: {

src/emulator/webpack.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const HtmlWebpackPlugin = require('html-webpack-plugin');
2+
const DefinePlugin = require('webpack').DefinePlugin;
23

34
module.exports = {
45
entry: [
@@ -8,5 +9,8 @@ module.exports = {
89
new HtmlWebpackPlugin({
910
template: 'assets/template.html'
1011
}),
12+
new DefinePlugin({
13+
MODE: JSON.stringify(process.env.MODE ?? 'dev')
14+
}),
1115
]
1216
};

0 commit comments

Comments
 (0)