Gathering detailed insights and metrics for babel-plugin-import-noop
Gathering detailed insights and metrics for babel-plugin-import-noop
npm install babel-plugin-import-noop
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
348,486
Last Day
124
Last Week
531
Last Month
2,870
Last Year
41,924
MIT License
1 Stars
13 Commits
1 Forks
15 Watchers
1 Branches
2 Contributors
Updated on Dec 29, 2016
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
babel-plugin-import-noop@1.0.1
Size
2.47 kB
NPM Version
2.14.12
Node Version
4.3.1
Cumulative downloads
Total Downloads
Last Day
74.6%
124
Compared to previous day
Last Week
-5.5%
531
Compared to previous week
Last Month
45.9%
2,870
Compared to previous month
Last Year
55.1%
41,924
Compared to previous year
No dependencies detected.
A babel plugin to turn certain types of import
statements into noops that declare empty objects.
If you're using CSS Modules via a build tool like Webpack's css-loader, then when you build your app bundle webpack will magically transform imports like:
1import style from './some-style.scss';
— into JavaScript that injects this style into your pages.
However, if you want to run tests, you'll hit a syntax error if you try to run the JavaScript files as-is, since the CSS they're importing isn't valid JavaScript. You could compile an entire "test bundle" with webpack before running the tests, but that adds a substantial boot time to every run. Instead, you can use the babel require hook, and use this plugin to replace all instances of:
1import style from './some-style.scss';
with
1const style = {};
— during compilation.
1$ npm install --save-dev babel-plugin-import-noop
Then, in your .babelrc
:
1{ 2 "plugins": ["import-noop"] 3}
Or, to only load this plugin during tests (i.e. not in your actual bundle):
1{ 2 "env": { 3 "test": { 4 "plugins": ["import-noop"] 5 } 6 } 7}
1NODE_ENV=test mocha ....
To specify a list of file extensions which should be transformed, you can add additional options to the plugin declaration:
1{ 2 "plugins": [ 3 ["import-noop", { 4 "extensions": ["scss", "css"] 5 }] 6 ] 7}
Since the newly defined object won't have any properties, anything you're
reading from it in your code (e.g. style.className
) will resolve to
undefined
. A pull request to allow defining properties using the plugin
configuration would be very useful!
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/10 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-03-10
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