From 2173770ebcea4b3b4eee266058e655e2ee2e72ee Mon Sep 17 00:00:00 2001 From: Bogdan Bodnar Date: Wed, 28 Aug 2019 10:10:49 +0200 Subject: [PATCH] Add module resolver plugin. --- babel.config.js | 7 +++++ package-lock.json | 37 ++++++++++++++++++++++++++ package.json | 1 + src/{testUtils => }/__mocks__/axios.js | 0 src/bootstrap/Button.js | 2 +- src/index.js | 2 +- 6 files changed, 47 insertions(+), 2 deletions(-) rename src/{testUtils => }/__mocks__/axios.js (100%) diff --git a/babel.config.js b/babel.config.js index 9cb4b98..fcf53b6 100644 --- a/babel.config.js +++ b/babel.config.js @@ -6,5 +6,12 @@ module.exports = { plugins: [ "@babel/plugin-transform-runtime", "@babel/plugin-syntax-export-default-from", + ["module-resolver", { + root: ["./src"], + alias: { + test: "./test", + underscore: "lodash", + }, + }], ], }; diff --git a/package-lock.json b/package-lock.json index 643cbde..d9a84f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1840,6 +1840,19 @@ "@types/babel__traverse": "^7.0.6" } }, + "babel-plugin-module-resolver": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/babel-plugin-module-resolver/-/babel-plugin-module-resolver-3.2.0.tgz", + "integrity": "sha512-tjR0GvSndzPew/Iayf4uICWZqjBwnlMWjSx6brryfQ81F9rxBVqwDJtFCV8oOs0+vJeefK9TmdZtkIFdFe1UnA==", + "dev": true, + "requires": { + "find-babel-config": "^1.1.0", + "glob": "^7.1.2", + "pkg-up": "^2.0.0", + "reselect": "^3.0.1", + "resolve": "^1.4.0" + } + }, "babel-plugin-react-transform": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/babel-plugin-react-transform/-/babel-plugin-react-transform-3.0.0.tgz", @@ -4227,6 +4240,24 @@ } } }, + "find-babel-config": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/find-babel-config/-/find-babel-config-1.2.0.tgz", + "integrity": "sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA==", + "dev": true, + "requires": { + "json5": "^0.5.1", + "path-exists": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + } + } + }, "find-cache-dir": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", @@ -8871,6 +8902,12 @@ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", "dev": true }, + "reselect": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-3.0.1.tgz", + "integrity": "sha1-79qpjqdFEyTQkrKyFjpqHXqaIUc=", + "dev": true + }, "resolve": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", diff --git a/package.json b/package.json index 026ecbe..143050c 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "babel-eslint": "^9.0.0", "babel-jest": "^24.8.0", "babel-loader": "^8.0.6", + "babel-plugin-module-resolver": "^3.2.0", "babel-plugin-react-transform": "^3.0.0", "babel-polyfill": "^6.26.0", "eslint": "^5.16.0", diff --git a/src/testUtils/__mocks__/axios.js b/src/__mocks__/axios.js similarity index 100% rename from src/testUtils/__mocks__/axios.js rename to src/__mocks__/axios.js diff --git a/src/bootstrap/Button.js b/src/bootstrap/Button.js index 887e05e..d87a114 100644 --- a/src/bootstrap/Button.js +++ b/src/bootstrap/Button.js @@ -39,7 +39,7 @@ export function Button({ ?