You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried using apollo_compiler in a wasm context. My Rust app compiles successfully but encounters a "Module not found" error (seemingly at the wasm-pack step being handled by webpack, though that's not entirely apparent to me).
I mention this in the repro README, but it seems Instant::now is unavailable in wasm and somewhere in the dependency tree of apollo_compiler it's being used. Unfortunately this isn't caught as part of building for wasm, else this error would turn up in our wasm build step in CI.
The initial commit comes from this handy template. Things run as expected from that commit. The second commit shows my diff which introduces apollo_compiler usage and the error mentioned in the README occurs.
Expected result
I expect to be able to use apollo_compiler in a wasm context without module resolution errors.
Actual result
Module resolution error:
ERROR in ./pkg/index_bg.wasm
Module not found: Error: Can't resolve 'env' in '/Users/trevorscheer/Desktop/compiler-wasm-reproduction/pkg'
@ ./pkg/index_bg.wasm
@ ./pkg/index.js
@ ./js/index.js
Environment
Happy to provide more specifics if needed, but I don't think this is env specific
Operating system and version: MacOS 14.4 / M1
Shell (bash/zsh/powershell): zsh
apollo-rs crate: apollo_compiler
Crate version: 0.11.3
The text was updated successfully, but these errors were encountered:
After digging around a bit more, it became apparent to me the issue was in the usage of the instant crate somewhere within our deps, not std::time::Instant.
The instant crate provides a feature for wasm-bindgen which needs to be enabled in Cargo.toml like so:
instant = { version = "0.1.12", features = [ "wasm-bindgen" ] }
I'm not super familiar with the rust/wasm ecosystem, deps, and features of deps yet so this took me awhile to arrive at the solution. Is this something worth documenting in our README, perhaps?
This issue is probably fine to close, but I will leave it up to you folks in case there's a better solution than the one I've arrived at that y'all have in mind.
Description
I tried using
apollo_compiler
in a wasm context. My Rust app compiles successfully but encounters a "Module not found" error (seemingly at thewasm-pack
step being handled by webpack, though that's not entirely apparent to me).I mention this in the repro README, but it seems
Instant::now
is unavailable in wasm and somewhere in the dependency tree ofapollo_compiler
it's being used. Unfortunately this isn't caught as part of building for wasm, else this error would turn up in our wasm build step in CI.Also in the README but worth referencing here, this thread is highly relevant.
Steps to reproduce
Clone this repo:
https://github.com/trevor-scheer/compiler-wasm-reproduction
Reproduction steps are at the bottom of the README.
The initial commit comes from this handy template. Things run as expected from that commit. The second commit shows my diff which introduces
apollo_compiler
usage and the error mentioned in the README occurs.Expected result
I expect to be able to use
apollo_compiler
in a wasm context without module resolution errors.Actual result
Module resolution error:
Environment
Happy to provide more specifics if needed, but I don't think this is env specific
zsh
apollo-rs
crate:apollo_compiler
0.11.3
The text was updated successfully, but these errors were encountered: