Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lwc/features

Package Overview
Dependencies
Maintainers
12
Versions
596
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwc/features

LWC Features Flags

  • 1.1.14-alpha3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
12
Weekly downloads
 
Created
Source

Features

RFC

Compile-time flags

Runtime flags

Runtime flags can be enabled or disabled by setting a boolean value for that flag in globalThis.LWC_config.features. If the flag is not explicitly configured, the feature is disabled by default. This configuration object must appear before @lwc/engine is initialized and should be defined at the application layer.

Limitations

Must be all uppercase
// Does not work
if (enableFoo) {
    ...
}

// Does work
if (ENABLE_FOO) {
    ...
}
Only works with if-statements
// Does not work
const foo = ENABLE_FOO ? 1 : 2;

// Does work
let foo;
if (ENABLE_FOO) {
    foo = 1;
} else {
    foo = 2;
}
Only works with identifiers
// Does not work
if (isTrue(ENABLE_AWESOME_FEATURE)) {
    // awesome feature
}

// Does work
if (ENABLE_AWESOME_FEATURE) {
    // awesome feature
}
Initialization code cannot be tested

Toggling the value of ENABLE_FOO during a test will not change the return value of getFooValue.

import { ENABLE_FOO } from '@lwc/features';

let foo;
if (ENABLE_FOO) {
    foo = 1;
} else {
    foo = 2;
}

function getFooValue() {
    return foo;
}

FAQs

Package last updated on 26 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc