Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

fix: override rust type to javascript #2055

Merged
merged 1 commit into from
Sep 2, 2021
Merged

Conversation

nilslice
Copy link
Contributor

@nilslice nilslice commented Sep 1, 2021

the rust type seems to only have been added as a way to automatically trigger wasm-pack, but it's much better to put that in a custom [build] step instead. eventually, we really should phase out the rust type from wrangler altogether, but this at minimum makes the new rust template work.

@nilslice nilslice requested a review from a team as a code owner September 1, 2021 23:44
@threepointone
Copy link
Contributor

will this break existing projects?

@nilslice
Copy link
Contributor Author

nilslice commented Sep 2, 2021

@threepointone, nope! this only takes affect when calling wrangler generate. all existing type = rust projects remain unaffected.

@threepointone
Copy link
Contributor

But new rust projects won't use wasm-pack? As in, they'll work differently from what they work like before? (Sorry for the noob question, just wondering if this is a breaking change). Rust projects will have to do their own compilation after this, and will behave like a 'javascript' (aka no build) project?

(Long term I agree we should do away with 'type' completely)

@nilslice
Copy link
Contributor Author

nilslice commented Sep 2, 2021

The build for new rust projects uses a "custom build" command, and is not compatible with old-style rust projects. But this change doesn't affect any old projects who still use type = "rust". Those will still be recognized by wrangler build and continue to compile.

With this change, only new projects which are generated with --type rust will have different behavior.

@nilslice
Copy link
Contributor Author

nilslice commented Sep 2, 2021

Rust projects will have to do their own compilation after this, and will behave like a 'javascript' (aka no build) project?

Yes, but in the new template, we provide a new build command that handles the compilation specifically how workers-rs projects need to be built.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants