Skip to content

Commit 2bdc25a

Browse files
Pack fs only when target is wasi
1 parent 9d8c66d commit 2bdc25a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/ruby_wasm/packager.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ def package(executor, dest_dir, options)
2929
fs.remove_non_runtime_files(executor)
3030
fs.remove_stdlib(executor) unless options[:stdlib]
3131

32-
wasi_vfs = RubyWasmExt::WasiVfs.new
33-
wasi_vfs.map_dir("/bundle", fs.bundle_dir)
34-
wasi_vfs.map_dir("/usr", File.dirname(fs.ruby_root))
32+
if full_build_options[:target] == "wasm32-unknown-wasi"
33+
# wasi-vfs supports only WASI target
34+
wasi_vfs = RubyWasmExt::WasiVfs.new
35+
wasi_vfs.map_dir("/bundle", fs.bundle_dir)
36+
wasi_vfs.map_dir("/usr", File.dirname(fs.ruby_root))
3537

36-
wasm_bytes = wasi_vfs.pack(wasm_bytes)
38+
wasm_bytes = wasi_vfs.pack(wasm_bytes)
39+
end
3740

3841
wasm_bytes = RubyWasmExt.preinitialize(wasm_bytes) if options[:optimize]
3942
wasm_bytes

0 commit comments

Comments
 (0)