Gathering detailed insights and metrics for babel-plugin-transform-define
Gathering detailed insights and metrics for babel-plugin-transform-define
Gathering detailed insights and metrics for babel-plugin-transform-define
Gathering detailed insights and metrics for babel-plugin-transform-define
Compile time code replacement for babel similar to Webpack's DefinePlugin
npm install babel-plugin-transform-define
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
245 Stars
134 Commits
31 Forks
43 Watchers
8 Branches
60 Contributors
Updated on Mar 03, 2025
Latest Version
2.1.4
Package Id
babel-plugin-transform-define@2.1.4
Unpacked Size
13.56 kB
Size
5.01 kB
File Count
5
NPM Version
9.6.7
Node Version
18.17.1
Published on
Sep 19, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1$ npm install --save-dev babel-plugin-transform-define
.babelrc
1{ 2 "plugins": [ 3 ["transform-define", { 4 "process.env.NODE_ENV": "production", 5 "typeof window": "object" 6 }] 7 ] 8}
.babelrc.js
1// E.g., any dynamic logic with JS, environment variables, etc. 2const overrides = require("./another-path.js"); 3 4module.exports = { 5 plugins: [ 6 ["transform-define", { 7 "process.env.NODE_ENV": "production", 8 "typeof window": "object", 9 ...overrides 10 }] 11 ] 12};
babel-plugin-transform-define
can transform certain types of code as a babel transformation.
Identifiers
.babelrc
1{ 2 "plugins": [ 3 ["transform-define", { 4 "VERSION": "1.0.0", 5 }] 6 ] 7}
Source Code
1VERSION; 2 3window.__MY_COMPANY__ = { 4 version: VERSION 5};
Output Code
1"1.0.0"; 2 3window.__MY_COMPANY__ = { 4 version: "1.0.0" 5};
Member Expressions
.babelrc
1{ 2 "plugins": [ 3 ["transform-define", { 4 "process.env.NODE_ENV": "production" 5 }] 6 ] 7}
Source Code
1if (process.env.NODE_ENV === "production") { 2 console.log(true); 3}
Output Code
1if (true) { 2 console.log(true); 3}
Unary Expressions
.babelrc
1{ 2 "plugins": [ 3 ["transform-define", { 4 "typeof window": "object" 5 }] 6 ] 7}
Source Code
1typeof window; 2typeof window === "object";
Output Code
1'object'; 2true;
Stable: Formidable is not planning to develop any new features for this project. We are still responding to bug reports and security concerns. We are still welcoming PRs for this project, but PRs that include new features should be small and easy to integrate and should not include breaking changes.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/17 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
16 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More