aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--builder/build.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/builder/build.go b/builder/build.go
index 940439667..e415781fe 100644
--- a/builder/build.go
+++ b/builder/build.go
@@ -825,10 +825,18 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
args = append(args, "--asyncify")
}
+ exeunopt := result.Executable
+
+ if config.Options.Work {
+ // Keep the work direction around => don't overwrite the .wasm binary with the optimized version
+ exeunopt += ".pre-wasm-opt"
+ os.Rename(result.Executable, exeunopt)
+ }
+
args = append(args,
opt,
"-g",
- result.Executable,
+ exeunopt,
"--output", result.Executable,
)