diff --git a/src/lib/compiler.cpp b/src/lib/compiler.cpp index c131dd7..0009946 100644 --- a/src/lib/compiler.cpp +++ b/src/lib/compiler.cpp @@ -372,6 +372,16 @@ SharedUnitFilesystemState inspect_shared_unit_filesystem(Request* context, Share ); state.required_time = std::max({state.source_time, state.setup_template_time, state.compiler_abi_time}); state.compiled_time = file_mtime(su->so_name); + if(compiler_wasm_unit_compile_enabled(context)) + { + time_t wasm_time = file_mtime(su->wasm_name); + // The wasm backend serves the .wasm, so a missing/stale .wasm must + // trigger a rebuild even when the .so is current. Treat the unit as + // compiled only as of the OLDER artifact; a missing .wasm (mtime 0) + // forces recompile via the existing needs_compile == (compiled_time==0). + if(wasm_time == 0 || wasm_time < state.compiled_time) + state.compiled_time = wasm_time; + } return(state); }