Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cross-platform worker builds #17

Merged
merged 3 commits into from Aug 26, 2021
Merged

cross-platform worker builds #17

merged 3 commits into from Aug 26, 2021

Conversation

caass
Copy link
Contributor

@caass caass commented Aug 25, 2021

add the rust-worker-build binary which wraps wasm-bindgen
and makes the necessary changes for our workers to be working.

there's no cargo install step yet because we haven't published it,
so for now just cargo install --path

add the rust-worker-build binary which wraps wasm-bindgen
and makes the necessary changes for our workers to be working.

there's no cargo install step yet because we haven't published it,
so for now just cargo install --path
@nilslice
Copy link
Contributor

Ran through a build and this isn't quite there yet. I think the general functionality is there, but the output doesn't quite work when you try to publish. The wrangler.toml should be changed to fix the paths so they match how this outputs code, and I got the following error after I updated my config file's paths:

Error: Something went wrong with the request to Cloudflare...
Uncaught SyntaxError: Cannot use import statement outside a module
  at line 1
 [API code: 10021]

My wrangler.toml attempt to match how you output the files:

name = "do-test-rust"
type = "javascript"

workers_dev = true
kv_namespaces = [
  { binding = "SOME_NAMESPACE", id = "" },
  { binding = "SOME_KV", id = "" }
]
vars = { SOME_VARIABLE = "some value" }

[build]
command = "rust-worker-build"

[build.upload]
# The "modules" upload format is required for all projects that implement a Durable Object namespace.
format = "modules"
dir = "build"
main = "./shim.mjs"

[[build.upload.rules]]
type = "CompiledWasm"
globs = ["**/*.wasm"]

[durable_objects]
bindings = [
  { name = "COUNTER", class_name = "Counter" }
]

@nilslice
Copy link
Contributor

LGTM!

@nilslice nilslice merged commit 1f6f5e1 into main Aug 26, 2021
@nilslice nilslice deleted the cass/rust-worker-build branch August 26, 2021 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants