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

Default platform setting for multi-target applications #3368

Open
ealmloff opened this issue Dec 16, 2024 · 1 comment
Open

Default platform setting for multi-target applications #3368

ealmloff opened this issue Dec 16, 2024 · 1 comment
Labels
cli Related to the dioxus-cli program

Comments

@ealmloff
Copy link
Member

Feature Request

In multi-target fullstack setups like the template with fullstack enabled the Cargo.toml must have features for each platform like this:

[features]
desktop = ["dioxus/desktop"]
web = ["dioxus/web"]
mobile = ["dioxus/mobile"]

server = ["dioxus/server"]

During a web build, two binaries are built: the server with the server feature enabled and the client with the web feature enabled.

web should not be a default feature flag because that would enable the web feature during the server build. That could cause issues with user code with web-only logic gated behind that flag.

Implement Suggestion

The CLI could read from a default_platform config with either web, desktop, or mobile to determine what platform to serve if --platform argument is set

Restore the default_platform setting that was removed in #2975

@ealmloff ealmloff added the cli Related to the dioxus-cli program label Dec 16, 2024
@ealmloff
Copy link
Member Author

There is some interaction here with the default features and rust analyzer. Whatever features we have enabled by default are used by default by rust analyzer. It sounds like the intention in #2975 was to enable a feature by default for rust analyzer. We could enable all features by default for rust analyzer and disable default features in the CLI when we serve, but it makes it more difficult to reason about what features are enabled when you build:

[features]
default = ["desktop", "web", "mobile", "server"]
desktop = ["dioxus/desktop"]
web = ["dioxus/web"]
mobile = ["dioxus/mobile"]
server = ["dioxus/server"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the dioxus-cli program
Projects
None yet
Development

No branches or pull requests

1 participant