Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
babel-plugin-package-name-import
Advanced tools
Readme
Import files from the current package by name
Install it locally to your project by running:
yarn add --dev babel-plugin-package-name-import
Add the plugin to your Babel configuration:
{
"plugins": ["package-name-import"]
}
Given that your package.json
contains:
{
"name": "project",
"main": "src/index.js"
}
You can import files from the current project by name:
import project from 'project'
Note that require
is not supported as its argument can be dynamically
computed.
If your project uses eslint-plugin-import, ensure that it can resolve current project imports by including the eslint-import-resolver-package-name-import plugin.
If your project uses Flow, ensure that it can resolve
current project imports by adding to .flowconfig
:
[options]
module.name_mapper='^project$' -> '<PROJECT_ROOT>'
module.name_mapper='^project\/\(.*\)$' -> '<PROJECT_ROOT>/\1'
Note that <PROJECT_ROOT>
is a special token and should be left unmodified.
FAQs
Import files from the current package by name
We found that babel-plugin-package-name-import 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
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).