{"name":"babel-plugin-module-resolver","version":"5.0.3","keywords":["babel","babel-plugin","module","resolver","alias","rewrite","resolve","rename","mapping","require","import"],"author":{"url":"http://tommyleunen.com","name":"Tommy Leunen","email":"tommy.leunen@gmail.com"},"license":"MIT","_id":"babel-plugin-module-resolver@5.0.3","maintainers":[{"name":"tleunen","email":"tommy.leunen@gmail.com"},{"name":"fatfisz","email":"fatfisz@gmail.com"}],"homepage":"https://github.com/tleunen/babel-plugin-module-resolver#readme","bugs":{"url":"https://github.com/tleunen/babel-plugin-module-resolver/issues"},"dist":{"shasum":"13f03cf29048ad7e0239e6a1c4dcc669d199f394","tarball":"http://registry-npm.ywwl.com/babel-plugin-module-resolver/download/babel-plugin-module-resolver-5.0.3.tgz","fileCount":12,"integrity":"sha512-h8h6H71ZvdLJZxZrYkaeR30BojTaV7O9GfqacY14SNj5CNB8ocL9tydNzTC0JrnNN7vY3eJhwCmkDj7tuEUaqQ==","signatures":[{"sig":"MEQCIBgRMxymTypuHMyZsG16GnG1G4wiVaZiEDjR9cJWXWwUAiBchd7ccDC++RtFXy35wMN3RnwbV3OeaPhRr6wCGPuF+w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25163,"size":8757,"noattachment":false,"key":"/babel-plugin-module-resolver/-/babel-plugin-module-resolver-5.0.3.tgz"},"jest":{"testRegex":"/test/.*\\.test\\.js$","testEnvironment":"node","collectCoverageFrom":["src/**/*.js","!src/log.js"]},"main":"lib/index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"da66dd73899222b6c71dfe59ffeba5040e1b73c6","scripts":{"lint":"eslint src test","test":"jest","compile":"babel src --out-dir lib","pretest":"npm run lint","release":"standard-version","prepublish":"npm run compile","test:watch":"jest --watch","test:coverage":"jest --coverage"},"_npmUser":{"name":"tleunen","email":"tommy.leunen@gmail.com"},"repository":{"url":"git+https://github.com/tleunen/babel-plugin-module-resolver.git","type":"git"},"_npmVersion":"11.10.0","description":"Module resolver plugin for Babel","directories":{},"lint-staged":{"*.{js}":["prettier-eslint --write"]},"_nodeVersion":"22.14.0","dependencies":{"glob":"^9.3.3","pkg-up":"^3.1.0","resolve":"^1.22.8","reselect":"^4.1.7","find-babel-config":"^2.1.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^4.3.6","eslint":"^6.7.2","@babel/cli":"^7.20.7","babel-core":"^7.0.0-bridge.0","babel-jest":"^29.3.1","@babel/core":"^7.20.12","common-tags":"^1.8.2","lint-staged":"^10.5.3","standard-version":"^9.5.0","@babel/preset-env":"^7.20.2","prettier-eslint-cli":"^5.0.0","eslint-plugin-import":"^2.19.1","eslint-config-prettier":"^6.7.0","eslint-config-airbnb-base":"^14.0.0","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-transform-modules-commonjs":"^7.20.11"},"_npmOperationalInternal":{"tmp":"tmp/babel-plugin-module-resolver_5.0.3_1773675157793_0.1754829913704159","host":"s3://npm-registry-packages-npm-production"},"readme":"# babel-plugin-module-resolver\n[![Maintenance Status][status-image]][status-url] [![NPM version][npm-image]][npm-url] [![Build Status Linux][circleci-image]][circleci-url] [![Build Status Windows][appveyor-image]][appveyor-url] [![Coverage Status][coverage-image]][coverage-url]\n\nA [Babel](http://babeljs.io) plugin to add a new resolver for your modules when compiling your code using Babel. This plugin allows you to add new \"root\" directories that contain your modules. It also allows you to setup a custom alias for directories, specific files, or even other npm modules.\n\n## Description\n\nThis plugin can simplify the require/import paths in your project. For example, instead of using complex relative paths like `../../../../utils/my-utils`, you can write `utils/my-utils`. It will allow you to work faster since you won't need to calculate how many levels of directory you have to go up before accessing the file.\n\n```js\n// Use this:\nimport MyUtilFn from 'utils/MyUtilFn';\n// Instead of that:\nimport MyUtilFn from '../../../../utils/MyUtilFn';\n\n// And it also work with require calls\n// Use this:\nconst MyUtilFn = require('utils/MyUtilFn');\n// Instead of that:\nconst MyUtilFn = require('../../../../utils/MyUtilFn');\n```\n\n## Getting started\n\nInstall the plugin\n\n```\nnpm install --save-dev babel-plugin-module-resolver\n```\nor\n```\nyarn add --dev babel-plugin-module-resolver\n```\n\nSpecify the plugin in your `.babelrc` with the custom root or alias. Here's an example:\n```json\n{\n  \"plugins\": [\n    [\"module-resolver\", {\n      \"root\": [\"./src\"],\n      \"alias\": {\n        \"test\": \"./test\",\n        \"underscore\": \"lodash\"\n      }\n    }]\n  ]\n}\n```\n\n**.babelrc.js version**\nSpecify the plugin in your `.babelrc.js` file with the custom root or alias. Here's an example:\n```\n\nconst plugins = [\n  [\n    require.resolve('babel-plugin-module-resolver'),\n    {\n      root: [\"./src/\"],\n      alias: {\n        \"test\": \"./test\"\n      }\n    }\n\n  ]\n\n];\n\n```\nGood example: // https://gist.github.com/nodkz/41e189ff22325a27fe6a5ca81df2cb91\n\n\n## Documentation\n\nbabel-plugin-module-resolver can be configured and controlled easily, check the [documentation](DOCS.md) for more details\n\nAre you a plugin author (e.g. IDE integration)? We have [documented the exposed functions](DOCS.md#for-plugin-authors) for use in your plugins!\n\n## ESLint plugin\n\nIf you're using ESLint, you should use [eslint-plugin-import][eslint-plugin-import], and [eslint-import-resolver-babel-module][eslint-import-resolver-babel-module] to remove falsy unresolved modules. If you want to have warnings when aliased modules are being imported by their relative paths, you can use [eslint-plugin-module-resolver](https://github.com/HeroProtagonist/eslint-plugin-module-resolver).\n\n## Editors autocompletion\n\n- Atom: Uses [atom-autocomplete-modules][atom-autocomplete-modules] and enable the `babel-plugin-module-resolver` option.\n- VS Code: Configure the [path mapping](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping) in `jsconfig.json` (`tsconfig.json` for TypeScript), e.g.:\n\n```js\n{\n  \"compilerOptions\": {\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"*\": [\"src/*\"],\n      \"test/*\": [\"test/*\"],\n      \"underscore\": [\"lodash\"]\n    }\n  }\n}\n```\n\n- IntelliJ/WebStorm: You can mark your module directories as \"resources root\" e.g if you have `../../../utils/MyUtilFn` you can mark\n  `../../../utils` as \"resources root\". This has the problem that your alias also has to be named `utils`. The second option is to add\n  a `webpack.config.js` to your project and use it under File->Settings->Languages&Frameworks->JavaScript->Webpack. This will trick webstorm\n  into resolving the paths and you can use any alias you want e.g.:\n\n```js\nvar path = require('path');\n\nmodule.exports = {\n  resolve: {\n    extensions: ['.js', '.json', '.vue'],\n    alias: {\n      utils: path.resolve(__dirname, '../../../utils/MyUtilFn'),\n    },\n  },\n};\n```\n\n\n## License\n\nMIT, see [LICENSE.md](/LICENSE.md) for details.\n\n## Who is using babel-plugin-module-resolver ?\n\n- Algolia: [InstantSearch.js](https://github.com/algolia/instantsearch.js)\n- Airbnb: [Lottie React Native](https://github.com/airbnb/lottie-react-native)\n- AppDirect\n- Callstack: [React Native Paper](https://github.com/callstack/react-native-paper)\n- Codility\n- Eleme: [Element](https://github.com/ElemeFE/element)\n- Expo: [Expo SDK](https://github.com/expo/expo/tree/master/packages/babel-preset-expo)\n- FormidableLabs: [Victory Native](https://github.com/FormidableLabs/victory-native)\n- OpenCollective: [OpenCollective](https://github.com/opencollective/frontend)\n- React Community: [React Native Maps](https://github.com/react-community/react-native-maps)\n- Uber: [Seer](https://github.com/uber-web/Seer), [react-vis](https://github.com/uber/react-vis)\n- Quasar Framework: [Quasar](https://github.com/quasarframework/quasar)\n- Vuetify.js [Vuetify](https://github.com/vuetifyjs/vuetify)\n- Zeit: [Next.js](https://github.com/zeit/next.js)\n- Zenika: [Immutadot](https://github.com/Zenika/immutadot)\n\nAre you also using it? Send a PR!\n\n[status-image]: https://img.shields.io/badge/status-maintained-brightgreen.svg\n[status-url]: https://github.com/tleunen/babel-plugin-module-resolver\n\n[npm-image]: https://img.shields.io/npm/v/babel-plugin-module-resolver.svg\n[npm-url]: https://www.npmjs.com/package/babel-plugin-module-resolver\n\n[circleci-image]: https://img.shields.io/circleci/project/tleunen/babel-plugin-module-resolver/master.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSItMTQyLjUgLTE0Mi41IDI4NSAyODUiPjxjaXJjbGUgcj0iMTQxLjciIGZpbGw9IiNERDQ4MTQiLz48ZyBpZD0iYSIgZmlsbD0iI0ZGRiI%2BPGNpcmNsZSBjeD0iLTk2LjQiIHI9IjE4LjkiLz48cGF0aCBkPSJNLTQ1LjYgNjguNGMtMTYuNi0xMS0yOS0yOC0zNC00Ny44IDYtNSA5LjgtMTIuMyA5LjgtMjAuNnMtMy44LTE1LjctOS44LTIwLjZjNS0xOS44IDE3LjQtMzYuNyAzNC00Ny44bDEzLjggMjMuMkMtNDYtMzUuMi01NS4zLTE4LjctNTUuMyAwYzAgMTguNyA5LjMgMzUuMiAyMy41IDQ1LjJ6Ii8%2BPC9nPjx1c2UgeGxpbms6aHJlZj0iI2EiIHRyYW5zZm9ybT0icm90YXRlKDEyMCkiLz48dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSgyNDApIi8%2BPC9zdmc%2B\n[circleci-url]: https://circleci.com/gh/tleunen/babel-plugin-module-resolver\n\n[appveyor-image]: https://img.shields.io/appveyor/ci/tleunen/babel-plugin-module-resolver/master.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjEyOCIgaGVpZ2h0PSIxMjgiIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48ZyBmaWxsPSIjMUJBMUUyIiB0cmFuc2Zvcm09InNjYWxlKDgpIj48cGF0aCBkPSJNMCAyLjI2NWw2LjUzOS0uODg4LjAwMyA2LjI4OC02LjUzNi4wMzd6Ii8%2BPHBhdGggZD0iTTYuNTM2IDguMzlsLjAwNSA2LjI5My02LjUzNi0uODk2di01LjQ0eiIvPjxwYXRoIGQ9Ik03LjMyOCAxLjI2MWw4LjY3LTEuMjYxdjcuNTg1bC04LjY3LjA2OXoiLz48cGF0aCBkPSJNMTYgOC40NDlsLS4wMDIgNy41NTEtOC42Ny0xLjIyLS4wMTItNi4zNDV6Ii8%2BPC9nPjwvc3ZnPg==\n[appveyor-url]: https://ci.appveyor.com/project/tleunen/babel-plugin-module-resolver\n\n[coverage-image]: https://codecov.io/gh/tleunen/babel-plugin-module-resolver/branch/master/graph/badge.svg\n[coverage-url]: https://codecov.io/gh/tleunen/babel-plugin-module-resolver\n\n[eslint-import-resolver-babel-module]: https://github.com/tleunen/eslint-import-resolver-babel-module\n[eslint-plugin-import]: https://github.com/benmosher/eslint-plugin-import\n[atom-autocomplete-modules]: https://github.com/nkt/atom-autocomplete-modules\n","publish_time":1773675157961,"_cnpm_publish_time":1773675157961,"dist-tags":{"beta":"3.0.0-beta.5","latest":"5.0.3"}}