Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@jcoreio/babel-plugin-transform-define
Advanced tools
Babel plugin that replaces member expressions and typeof statements with strings
npm install babel-plugin-transform-define
.babelrc
{
"plugins": [
["transform-define", {
"process.env.NODE_ENV": "production",
"typeof window": "object"
}]
]
}
.babelrc
{
"plugins": [
["transform-define", "./path/to/config/file.js"]
]
}
Note: Paths are relative to `process.cwd()``
babel-plugin-transform-define
can transform certain types of code as a babel transformation.
#####Identifiers
.babelrc
{
"plugins": [
["transform-define", {
"VERSION": "1.0.0",
}]
]
}
Source Code
VERSION;
window.__MY_COMPANY__ = {
version: VERSION
};
Output Code
"1.0.0";
window.__MY_COMPANY__ = {
version: "1.0.0"
};
#####Member Expressions
.babelrc
{
"plugins": [
["transform-define", {
"process.env.NODE_ENV": "production"
}]
]
}
Source Code
if (process.env.NODE_ENV === "production") {
console.log(true);
}
Output Code
if (true) {
console.log(true);
}
#####Unary Expressions
.babelrc
{
"plugins": [
["transform-define", {
"typeof window": "object"
}]
]
}
Source Code
typeof window;
typeof window === "object";
Output Code
'object';
true;
FAQs
Babel plugin that replaces member expressions and typeof statements with strings
The npm package @jcoreio/babel-plugin-transform-define receives a total of 1 weekly downloads. As such, @jcoreio/babel-plugin-transform-define popularity was classified as not popular.
We found that @jcoreio/babel-plugin-transform-define 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.