Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"url": "git+https://github.com/opencor/webapp.git"
},
"type": "module",
"version": "0.20260727.1",
"version": "0.20260727.2",
"engines": {
"bun": ">=1.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"./style.css": "./dist/opencor.css"
},
"version": "0.20260727.1",
"version": "0.20260727.2",
"libopencorVersion": "1.20260723.2",
"scripts": {
"build": "vite build && bun scripts/generate.version.ts",
Expand Down
6 changes: 1 addition & 5 deletions src/renderer/src/common/initialisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,9 @@ export const initialiseLocApi = async (): Promise<void> => {
// @ts-expect-error (window.locApi is defined)
locApi.setCppLocApi(window.locApi);
} else {
// We are running OpenCOR's Web app, so we must import libOpenCOR's WebAssembly module.
// We are running OpenCOR's Web app, so we must import libOpenCOR's WebAssembly module and instantiate it.

try {
// Use a configurable base URL (set via Vite `define`). The default is a same-origin path proxied to opencor.ws
// during development. Production web deployments can override this at build time to point to wherever the
// libOpenCOR WASM build is hosted (e.g. a CDN or a local path served by the web server).

const libOpenCOR = (await import(/* @vite-ignore */ `${__LIBOPENCOR_WASM_BASE_URL__}/libopencor.js`))
.default as WasmFactory;

Expand Down
5 changes: 5 additions & 0 deletions src/renderer/vite.lib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as postcss from 'postcss';
import vitePlugin from 'unplugin-vue-components/vite';
import * as vite from 'vite';

import { libopencorVersion } from './scripts/libopencor.version';

export default vite.defineConfig({
build: {
lib: {
Expand All @@ -33,6 +35,9 @@ export default vite.defineConfig({
},
target: 'esnext'
},
define: {
__LIBOPENCOR_WASM_BASE_URL__: JSON.stringify(`https://opencor.ws/libopencor/downloads/wasm/${libopencorVersion}`)
},
plugins: [
// Note: this must be in sync with vite.config.ts, except for the process-css-layers plugin which is only needed for
// the library build (to prevent styles from leaking into and being overridden by host apps).
Expand Down
Loading