Skip to content

Commit

Permalink
Build with ENVIRONMENT=node,web, so that the .wasm doesn't have to be…
Browse files Browse the repository at this point in the history
… manually loaded
  • Loading branch information
curiousdannii committed Dec 12, 2024
1 parent ba9b1f4 commit 3dc8086
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
needs: build
strategy:
matrix:
node: [20, 22]
node: [20, 22, 23]
name: test (Node v${{ matrix.node }})
runs-on: ubuntu-latest
steps:
Expand Down
5 changes: 1 addition & 4 deletions bin/emglken.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ async function run()
Dialog,
GlkOte,
}
const wasmBinary = fs.readFileSync(new URL(`../build/${format.id}.wasm`, import.meta.url))

process.on('unhandledRejection', error => {
if (error.name !== 'ExitStatus' || error.message !== 'Program terminated with exit(0)') {
Expand All @@ -97,9 +96,7 @@ async function run()
})

const engine = (await import(`../build/${format.id}.js`)).default
const vm = await engine({
wasmBinary,
})
const vm = await engine()
vm.start(options)
}

Expand Down
2 changes: 1 addition & 1 deletion src/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function(emglken_vm target)
# Output options
--minify 0
--profiling-funcs
-sENVIRONMENT=web
-sENVIRONMENT=node,web
-sEXPORT_ES6=1
-sMODULARIZE=1
# Optimisations
Expand Down
4 changes: 2 additions & 2 deletions src/preamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ function accept(data) {

// And now some things just to patch over Emscripten's lack of a none environment. These could probably be removed if https://github.com/emscripten-core/emscripten/issues/12184 ever gets implemented
// Add an importScripts function to prevent an assertion error
function importScripts() {}
//function importScripts() {}
// Fake locateFile so that Lectrote doesn't get tripped up on import.meta.url not being handled in CJS properly
Module['locateFile'] = function() {}
//Module['locateFile'] = function() {}

0 comments on commit 3dc8086

Please sign in to comment.