
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
babel-plugin-module-selector
Advanced tools
This plugin allows you to replace one module reference with another module reference based on your setting. You can use this plugin if you have a project where customization of modules is a requirement.
npm install babel-plugin-module-selector
Configure your .babelrc
to use this plugin. An example of it is provided below.
{
"plugins": [
["module-selector", {
"roots": ["src"],
"selectorsRoot": "customizations"
}]
]
}
In roots
you define the folders under which transformations will apply. selectorsRoot
is the root folder where you place all your customization selectors. selectorsRoot
should be within roots
. Each customization selector can mirror a part of the folder structure of your root. I.e:
project
src
a
b
customizations
selectorA
a
selectorB
b
With the example folder structure above, when we build with selector selectorA
, src/customizations/selectorA/a
is used whenever a
is required/imported. However b
is still required/imported from src/b
.
This model allows you to partialy replace a standard version of your app while still reusing most of the code.
You can use the BABEL_MODULE_SELECTOR
environment variable to control which selector to use for builds, or you can add a selector
config to your .babelrc
to do the same.
FAQs
Replace modules based on a selector
We found that babel-plugin-module-selector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.