From 6ec3c8b6536b07d5a342aeb8631c7f8b32ff04ef Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Wed, 18 Sep 2024 16:20:11 -0400 Subject: [PATCH] dev: add emulator prod deployment --- src/emulator/src/main.js | 10 +++++++--- src/emulator/webpack.config.js | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/emulator/src/main.js b/src/emulator/src/main.js index 8a04929947..6966b9e2fa 100644 --- a/src/emulator/src/main.js +++ b/src/emulator/src/main.js @@ -1,5 +1,9 @@ "use strict"; +console.log(`emulator running in mode: ${MODE}`) + +const PATH_V86 = MODE === 'dev' ? '/vendor/v86' : './vendor/v86'; + const { XDocumentPTT } = require("../../phoenix/src/pty/XDocumentPTT"); const { NewWispPacketStream, @@ -132,15 +136,15 @@ window.onload = async function() ); const arrayBuffer = await resp.arrayBuffer(); var emulator = window.emulator = new V86({ - wasm_path: "/vendor/v86/v86.wasm", + wasm_path: PATH_V86 + "/v86.wasm", memory_size: 512 * 1024 * 1024, vga_memory_size: 2 * 1024 * 1024, screen_container: document.getElementById("screen_container"), bios: { - url: "/vendor/v86/bios/seabios.bin", + url: PATH_V86 + "/bios/seabios.bin", }, vga_bios: { - url: "/vendor/v86/bios/vgabios.bin", + url: PATH_V86 + "/bios/vgabios.bin", }, initrd: { diff --git a/src/emulator/webpack.config.js b/src/emulator/webpack.config.js index 6983e59a3a..6dee896116 100644 --- a/src/emulator/webpack.config.js +++ b/src/emulator/webpack.config.js @@ -1,4 +1,5 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); +const DefinePlugin = require('webpack').DefinePlugin; module.exports = { entry: [ @@ -8,5 +9,8 @@ module.exports = { new HtmlWebpackPlugin({ template: 'assets/template.html' }), + new DefinePlugin({ + MODE: JSON.stringify(process.env.MODE ?? 'dev') + }), ] };