
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@rnx-kit/babel-plugin-import-path-remapper
Advanced tools
Babel plugin for remapping 'lib/' imports to 'src/'
@rnx-kit/babel-plugin-import-path-remapper
remaps **/lib/**
imports to
**/src/**
. This is useful for packages that are not correctly exporting
everything via their index.ts
, but you still want to consume the TypeScript
files rather than the transpiled JavaScript.
Add @rnx-kit/babel-plugin-import-path-remapper
to your babel.config.js
under
plugins. For example, to remap all paths under the @rnx-kit
scope:
// babel.config.js
module.exports = {
presets: ["module:metro-react-native-babel-preset"],
overrides: [
{
test: /\.tsx?$/,
plugins: [
// @babel/plugin-transform-typescript doesn't support `const enum`s.
// See https://babeljs.io/docs/en/babel-plugin-transform-typescript#caveats
// for more details.
"const-enum",
[
"@rnx-kit/babel-plugin-import-path-remapper",
{ test: (source) => source.startsWith("@rnx-kit/") },
],
],
},
],
};
Or, if you're using @rnx-kit/metro-config
:
// babel.config.js
const { makeBabelConfig } = require("@rnx-kit/metro-config");
module.exports = makeBabelConfig([
[
"@rnx-kit/babel-plugin-import-path-remapper",
{ test: (source) => source.startsWith("@rnx-kit/") },
],
]);
Option | Type | Description |
---|---|---|
test | (source: string) => boolean | [Required] A function returning whether the passed source should be redirected to another module. |
remap | (moduleName: string, path: string) => string | [Optional] A function returning the module that should be used instead, e.g. contoso/index.js -> contoso/index.ts . |
FAQs
Babel plugin for remapping 'lib/' imports to 'src/'
The npm package @rnx-kit/babel-plugin-import-path-remapper receives a total of 90 weekly downloads. As such, @rnx-kit/babel-plugin-import-path-remapper popularity was classified as not popular.
We found that @rnx-kit/babel-plugin-import-path-remapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.