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

[FR]: Allow using BuildSettingInfo flags for env vars #84

Open
1 task
titanous opened this issue Jan 6, 2023 · 0 comments
Open
1 task

[FR]: Allow using BuildSettingInfo flags for env vars #84

titanous opened this issue Jan 6, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@titanous
Copy link

titanous commented Jan 6, 2023

What is the current behavior?

Currently the only straightforward way that I'm aware of to propagate variables (API URLs, etc) into builds is by using --define with the variable interpolation in the env attribute. --define is not recommended according to the Bazel docs:

--define is only supported for backwards compatibility. Prefer Starlark build settings whenever possible.

Describe the feature

webpack_bundle and webpack_devserver should have a env_settings or equivalent attribute that takes a settings label to env var map, like the old esbuild rule from rules_nodejs has:

load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
string_flag(
    name = "api_endpoint",
    build_setting_default = "https://example.com/v1",
)
esbuild(
    name = "bundle",
    define_settings = {
        ":api_endpoint": "API_ENDPOINT",
    },
)

I think this would require adding the same attribute to js_run_devserver, as webpack_devserver is a macro and so wouldn't have access to the flags during the loading phase.

Fund our work

@titanous titanous added the enhancement New feature or request label Jan 6, 2023
@gregmagolan gregmagolan moved this to 📋 Backlog in Open Source Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant