Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for babel-plugin-module-resolver #522

Open
zeorin opened this issue Nov 15, 2018 · 0 comments
Open

Add support for babel-plugin-module-resolver #522

zeorin opened this issue Nov 15, 2018 · 0 comments

Comments

@zeorin
Copy link

zeorin commented Nov 15, 2018

https://github.com/tleunen/babel-plugin-module-resolver is a fairly widely used babel plugin, which allows for aliases and root folders. E.g. with the following in .babelrc:

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

you can write

import { throttle } from 'underscore';
import { MockBar } from 'test';
import Foo from 'components/Foo';

instead of

import { throttle } from 'lodash';
import { MockBar } from '../../test';
import Foo from '../../src/components/Foo';

It'd be nice if import-js picked up on this and its output was in line with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant