Registry /
devops / babel-plugin-tsconfig-paths-module-resolver
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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import 'babel-plugin-tsconfig-paths-module-resolver'
✗ import babelPluginTsconfigPaths from 'babel-plugin-tsconfig-paths-module-resolver'
Used as a Babel plugin string name, not a runtime import. Do not import as a default export.
resolvePath
✓ import { resolvePath } from 'babel-plugin-tsconfig-paths-module-resolver'
✗ const { resolvePath } = require('babel-plugin-tsconfig-paths-module-resolver')
CommonJS require works but the package ships TypeScript types; prefer ESM import for type safety.
createResolvePath
✓ import { createResolvePath } from 'babel-plugin-tsconfig-paths-module-resolver'
Available since v1.0.0; used to customize resolution with tsconfig-paths.
Shows minimal Babel config to enable tsconfig path aliases using the plugin.
// Install: npm install --save-dev babel-plugin-tsconfig-paths-module-resolver
// .babelrc
{
"presets": ["@babel/preset-env", "@babel/preset-typescript"],
"plugins": ["tsconfig-paths-module-resolver"]
}
// tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
}
}
// Now in your source: import { hello } from '@/hello'
// will resolve to src/hello.ts
Errors
Common errors & fixes
Module not found: Can't resolve '@/components/button' in '/path/to/file'
The tsconfig path alias is not recognized because tsconfig.json is missing or misconfigured, or the plugin is not correctly added.
fixEnsure tsconfig.json has baseUrl and paths defined, and the plugin is listed in Babel config's plugins array as 'tsconfig-paths-module-resolver'.
TypeError: Cannot read properties of undefined (reading 'compilerOptions')
The plugin cannot find or parse tsconfig.json. Possibly file missing or malformed.
fixVerify tsconfig.json exists in the project root and has valid JSON with compilerOptions object.
Error: Config error: plugin 'tsconfig-paths-module-resolver' not found
The package is not installed or Babel is unable to resolve it.
fixRun 'npm install --save-dev babel-plugin-tsconfig-paths-module-resolver' and verify node_modules.
Module build failed: TypeError: cloneNode is not a function
Incompatible version of @babel/core or babel-plugin-module-resolver. The plugin depends on Babel 7 API.
fixUpgrade @babel/core and babel-plugin-module-resolver to latest within major version 7.
Audit
Dependencies
babel-plugin-module-resolverrequiredCore module resolution logic
tsconfig-pathsrequiredReads and interprets tsconfig.json paths