{"id":19362,"library":"babel-root-slash-import","title":"babel-root-slash-import","description":"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.","status":"maintenance","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/mantrajs/babel-root-slash-import","tags":["javascript"],"install":[{"cmd":"npm install babel-root-slash-import","lang":"bash","label":"npm"},{"cmd":"yarn add babel-root-slash-import","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-root-slash-import","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The plugin transforms leading '/' to root-based paths per the configured rootPathSuffix.","wrong":"import SomeExample from '../../some/example.js'","symbol":"default import","correct":"import SomeExample from '/some/example.js'"}],"quickstart":{"code":"// .babelrc\n{\n  \"plugins\": [\"babel-root-slash-import\"]\n}\n\n// Then in your source file:\nimport MyModule from '/my-module.js';\nconsole.log(MyModule);\n\n// To use a custom root, e.g., src/js:\n// .babelrc\n{\n  \"plugins\": [\n    [\"babel-root-slash-import\", {\n      \"rootPathSuffix\": \"src/js\"\n    }]\n  ]\n}\n// Then import from 'src/js' root:\nimport Button from '/app/Button.js'; // resolves to src/js/app/Button.js","lang":"javascript","description":"Shows basic usage with default root and custom rootPathSuffix option."},"warnings":[{"fix":"Consider using babel-plugin-module-resolver instead.","message":"Plugin has not been updated since 2017 and may not work with modern Babel versions.","severity":"deprecated","affected_versions":">=1.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure babel-core is installed (npm install --save-dev @babel/core) or use a more modern plugin.","cause":"Missing Babel peer dependency or incompatibility with Babel 7+.","error":"Error: Cannot find module 'babel-core'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}