Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
babel-plugin-resolver
Advanced tools
Resolve modules from any directory.
import User from '../../models/User';
Becomes:
import User from 'models/User';
npm i babel-plugin-resolver --save
rm -rf ~/.babel.json
In .babelrc:
{
"presets": ["es2015"],
"plugins": [["resolver", { "resolveDirs": ["src"] }]]
}
Given the directory structure:
/app
.babelrc
/src
/models
User.js
/controllers
User.js
In app/controllers/User.js:
import UserModel from 'models/User';
// => resolves: "app/src/models/User.js"
This example uses Babel 6.
Note: Run rm -rf ~/.babel.json
if you're seeing errors.
Note2: This plugin is only called when you use import
, not require
.
In .babelrc:
{
"presets": ["es2015"],
"plugins": [["resolver", { "resolveDirs": ["src", "src/lib"] }]]
}
Given the directory structure:
/app
.babelrc
/src
/models
User.js
/controllers
User.js
/lib
utils.js
In app/controllers/User.js:
import UserModel from 'models/User';
// => resolves: "app/src/models/User.js"
import utils from 'utils';
// => resolves: "app/src/lib/utils.js"
npm i babel-plugin-resolver --save
rm -rf ~/.babel.json
While setting NODE_PATH=app
is a perfectly valid solution, babel-plugin-resolver
is for those who:
MIT
FAQs
Resolve modules from any directory.
The npm package babel-plugin-resolver receives a total of 669 weekly downloads. As such, babel-plugin-resolver popularity was classified as not popular.
We found that babel-plugin-resolver 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.