
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
babel-plugin-transform-import-paths
Advanced tools
Similar to Webpack's resolve.alias, this plugin transforms import, export, and require paths.
This plugin is inspired by
babel-plugin-root-imports
babel-plugin-root-imports.resolve.alias configuration.baseUrl and paths configuration options for resolving modules). This will allow using Babel v7 to transpile Typescript and transforming paths. Or, you can transpile using Typescript and then run Babel on the Typescript-transpiled code just to transform the paths.npm
npm install --save-dev babel-plugin-transform-import-paths
yarn
yarn add --dev babel-plugin-transform-import-paths
In your .baberc or .babelrc.js file:
{
"plugins": [
["babel-plugin-transform-import-paths", {
"~": "src",
}]
]
}
// Before
import { Menu } from "~/components";
// After
import { Menu } from "../../../components";
Pass multiple paths
// .babelrc or .babelrc.js
{
"plugins": [
["babel-plugin-transform-import-paths", {
"~": "src",
"_": "src/something/nested",
"MyFiles": "src/my-files"
}]
]
}
// src/some/nested/file/index.js
import Foo from "~/location-of-foo";
import Bar from "_/location-of-bar";
import Baz from "MyFiles";
// After
import Foo from "../../location-of-foo";
import Bar from "../../something/nested/location-of-bar";
import Baz from "../../my-files";
FAQs
Babel plugin to transform import paths
The npm package babel-plugin-transform-import-paths receives a total of 57 weekly downloads. As such, babel-plugin-transform-import-paths popularity was classified as not popular.
We found that babel-plugin-transform-import-paths 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.