for a browser / WASI use case this will result in an error like: "wasi_snapshot_preview1": module is not an object or function
because triple detection is based on the build output path:
|
static func deriveBuildConfiguration(wasmProductArtifact: URL) -> (configuration: String, triple: String) { |
|
// e.g. path/to/.build/wasm32-unknown-wasi/debug/Basic.wasm -> ("debug", "wasm32-unknown-wasi") |
|
|
|
// First, resolve symlink to get the actual path as SwiftPM 6.0 and earlier returns unresolved |
|
// symlink path for product artifact. |
|
let wasmProductArtifact = wasmProductArtifact.resolvingSymlinksInPath() |
|
let buildConfiguration = wasmProductArtifact.deletingLastPathComponent().lastPathComponent |
|
let triple = wasmProductArtifact.deletingLastPathComponent().deletingLastPathComponent().lastPathComponent |
|
return (buildConfiguration, triple) |
|
} |
and swift-build produces different out paths like this: .build/out/Products/Release-webassembly-wasm32/App.wasm
template variables like IS_WASI are no longer correctly derived
|
"IS_WASI": triple.hasPrefix("wasm32-unknown-wasi"), |
for a browser / WASI use case this will result in an error like:
"wasi_snapshot_preview1": module is not an object or functionbecause triple detection is based on the build output path:
JavaScriptKit/Plugins/PackageToJS/Sources/PackageToJS.swift
Lines 72 to 81 in e53155d
and
swift-buildproduces different out paths like this:.build/out/Products/Release-webassembly-wasm32/App.wasmtemplate variables like
IS_WASIare no longer correctly derivedJavaScriptKit/Plugins/PackageToJS/Sources/PackageToJS.swift
Line 813 in e53155d