Skip to content

Commit 272fea1

Browse files
committed
builder: keep un-wasm-opt'd .wasm if -work was passed
1 parent b6fd0c8 commit 272fea1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

builder/build.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,10 +825,18 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
825825
args = append(args, "--asyncify")
826826
}
827827

828+
exeunopt := result.Executable
829+
830+
if config.Options.Work {
831+
// Keep the work direction around => don't overwrite the .wasm binary with the optimized version
832+
exeunopt += ".pre-wasm-opt"
833+
os.Rename(result.Executable, exeunopt)
834+
}
835+
828836
args = append(args,
829837
opt,
830838
"-g",
831-
result.Executable,
839+
exeunopt,
832840
"--output", result.Executable,
833841
)
834842

0 commit comments

Comments
 (0)