emberjs / emberjs/ember-optional-features

Expose a module for runtime detection of opt-in/opt-out.

Open
#10 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
40
Forks
13
PR merge metrics
No merged PRs in 30d

Description

At times, addons will need to know if specific optional features are enabled or not. With the current architecture it is only possible to detect at runtime via `window.EmberENV._SOME_FLAG_HERE`, but we should not encourage that type of coupling to `EmberENV`.

As I see it we have a few options:

* Provide a `@ember/optional-features` module that can be imported and checked for various opt-in's. This would allow consumers to use an import and conditionals in their code based on a given optional flag value.
* Expose a custom babel plugin that can be used when an addon includes `@ember/optional-features` as a direct dependency. This babel plugin would provide custom build time replacement of `@ember/optional-features` based conditionals, and would therefore allow addons to include support for multiple variations of features without bloating the total asset size.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.