Skip to content

Commit

Permalink
perf(worker-rust): Add dev env for faster local build times (#5059)
Browse files Browse the repository at this point in the history
* chore(worker-rust): Remove deprecated `--local` parameter

* perf(worker-rust): Add `dev` environment for faster build times

* perf(worker-rust): Optimize for size in release builds
  • Loading branch information
futile authored Mar 8, 2024
1 parent 27fb22b commit 2a35697
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions templates/experimental/worker-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ crate-type = ["cdylib"]
worker = "0.0.18"

[profile.release]
opt-level = "s" # optimize for size in release builds
lto = true
strip = true
codegen-units = 1
2 changes: 1 addition & 1 deletion templates/experimental/worker-rust/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"deploy": "wrangler deploy",
"dev": "wrangler dev --local"
"dev": "wrangler dev --env dev"
},
"devDependencies": {
"wrangler": "^3.1.2"
Expand Down
3 changes: 3 additions & 0 deletions templates/experimental/worker-rust/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ compatibility_date = "2023-12-01"

[build]
command = "cargo install -q worker-build && worker-build --release"

[env.dev]
build = { command = "cargo install -q worker-build && worker-build --dev" }

0 comments on commit 2a35697

Please sign in to comment.