Registry / devops / babel-root-slash-import

babel-root-slash-import

JSON →
library1.1.0jsnpmunverified

A Babel plugin that allows import statements to use root-based paths starting with '/' instead of relative paths like '../../../'. Version 1.1.0 is the latest stable release. It has no updates in recent years and is likely in maintenance mode. Compared to alternatives like babel-plugin-module-resolver, this plugin has a simpler API but offers less configuration and flexibility.

npm install babel-root-slash-import
INSTALL
IMPORT
SIG · BABEL-ROOT-SLASH-I
B
babel-root-slash-import
devopsjavascriptv1.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default import
import SomeExample from '/some/example.js'
import SomeExample from '../../some/example.js'
The plugin transforms leading '/' to root-based paths per the configured rootPathSuffix.

Shows basic usage with default root and custom rootPathSuffix option.

// .babelrc { "plugins": ["babel-root-slash-import"] } // Then in your source file: import MyModule from '/my-module.js'; console.log(MyModule); // To use a custom root, e.g., src/js: // .babelrc { "plugins": [ ["babel-root-slash-import", { "rootPathSuffix": "src/js" }] ] } // Then import from 'src/js' root: import Button from '/app/Button.js'; // resolves to src/js/app/Button.js
Debug
Known issues
deprecatedPlugin has not been updated since 2017 and may not work with modern Babel versions.
fix
Consider using babel-plugin-module-resolver instead.
affects: >=1.1.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-core'
Missing Babel peer dependency or incompatibility with Babel 7+.
fix
Ensure babel-core is installed (npm install --save-dev @babel/core) or use a more modern plugin.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
babel-root-slash-import — npm install babel-root-slash-import · libregistry