Aliasing with Babel instead of Webpack

If you have been using aliases in Webpack, and want to switch over to Babel instead, you can use the Babel Module Resolver Plugin. Then just configure your aliases, such as:

“plugins”: [
[“module-resolver”, {
“root”: [“./src”],
“alias”: {
“test”: “./test”,
“underscore”: “lodash”

Great, now it builds and we can remove the aliases from Webpack, or if you can’t get them to resolve properly in JEST / Jasmine any more.

Oh wait, now it’s throwing false positives on import paths not being correct. The deceptive error lead me to needing another package, not defined as a dependency: ESLint Import Resolver for Babel

A close and re-open of my IDE, and the lint errors there were solved. A stop / start of gulp, and the false positives there went away, too.