Skip to content

Commit

Permalink
build(next/core): allow to specify tls backend for reqwest (vercel/tu…
Browse files Browse the repository at this point in the history
…rbo#2994)

Implement / fixes WEB-306.

We can't rely on default tls backend for reqwest and hope to work with
every target platform we support, due to several constraints. Some
target cannot use -sys (openssl-sys), and some can't build rustls due to
trasnsitive dep support issue.

PR creates explicit opt-in features for those and let upstream
application can specify what they need. `next-dev` currently sets
`native-tls` as default for the general dev workflow conveniences, but
that doesn't mean we promote it as default feature set - next-swc, or
other like standalone turbopack will configure features by themselves
when build binaries for their own.
  • Loading branch information
kwonoj committed Dec 15, 2022
1 parent f590196 commit 9e7bf34
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/next-swc/crates/next-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ turbo-tasks-build = { path = "../turbo-tasks-build" }

[features]
next-font-local = []
native-tls = ["turbo-tasks-fetch/native-tls"]
rustls-tls = ["turbo-tasks-fetch/rustls-tls"]
9 changes: 8 additions & 1 deletion packages/next-swc/crates/next-dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ name = "mod"
harness = false

[features]
default = ["cli", "custom_allocator"]
# By default, we enable native-tls for reqwest downstream trasntive features.
# This is for the convinience for all of daily dev workflow i.e running
# `cargo xxx` without explicitly specifying features, not that we want to
# promote this as default backend. Actual configuration is done when build next-swc,
# and also turbopack standalone when we have it.
default = ["cli", "custom_allocator", "native-tls"]
cli = []
serializable = []
tokio_console = [
Expand All @@ -30,6 +35,8 @@ tokio_console = [
profile = []
custom_allocator = ["turbo-malloc/custom_allocator"]
next-font-local = ["next-core/next-font-local"]
native-tls = ["next-core/native-tls"]
rustls-tls = ["next-core/rustls-tls"]

[dependencies]
anyhow = "1.0.47"
Expand Down

0 comments on commit 9e7bf34

Please sign in to comment.