summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-02-24 02:30:32 +0300
committerSaikari <[email protected]>2026-02-24 02:30:32 +0300
commite14d2b8f47ba95381c584c51b976cb5ff8707a31 (patch)
tree41424183063abb663acaedb6914b751fef19fc04
parent86a2b93c90df24d5876bea023e8346ad358bddae (diff)
Lazy fix to use .html instead of .js
-rw-r--r--xmake/actions/run/main.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua
index effa362e5..d9b5e83d3 100644
--- a/xmake/actions/run/main.lua
+++ b/xmake/actions/run/main.lua
@@ -56,9 +56,15 @@ function _run_wasm_target_in_browser(targetfile, opt)
local rundir = opt.rundir
local addenvs = opt.addenvs
local setenvs = opt.setenvs
+ -- prefer the .html file over .js for browser targets
+ -- @see https://github.com/xmake-io/xmake/issues/7340
+ local htmlfile = targetfile:gsub("%.js$", ".html")
+ if htmlfile ~= targetfile and os.isfile(htmlfile) then
+ targetfile = htmlfile
+ end
local emrun = find_tool("emrun")
if emrun then
- os.execv(emrun.program, {targetfile}, {
+ os.execv(emrun.program, {"--serve_root", path.directory(targetfile), targetfile}, {
curdir = rundir, detach = option.get("detach"), addenvs = addenvs, setenvs = setenvs})
else
local python = find_tool("python3")