A Babel plug-in for adding a new parser to a module when compiling code with Babel. This plugin allows you to add a new “root” directory containing modules. It also allows you to set custom aliases for directories, specific files, and even other NPM modules.

describe

// Use this:
import MyUtilFn from 'utils/MyUtilFn';
// Instead of that:
import MyUtilFn from '.. /.. /.. /.. /utils/MyUtilFn';

// And it also work with require calls
// Use this:
const MyUtilFn = require('utils/MyUtilFn');
// Instead of that:
const MyUtilFn = require('.. /.. /.. /.. /utils/MyUtilFn');
Copy the code

Star

reference

tleunen/babel-plugin-module-resolver


Welcome to follow my wechat official account: The Coder of wind and waves