entwicklerstube/babel-plugin-root-import

Using slashed in root prefix

vihanb opened this issue · 3 comments

My documentation generator (which runs through this plugin) is not very smart so it is incorrectly processes ./models/Foo.js as ./models/models/Foo.js for example. I have no idea why this is happening (issue with my docgen not this plugin) but I was hoping I could fix this using:

[
  {
    "rootPathPrefix": "~/models",
    "rootPathSuffix": "../../"
  },
  {
    "rootPathPrefix": "~",
    "rootPathSuffix": "../"
  }
]

however this doesn't seem to work. Is there a way to do something like this?

From the readme:

Custom rootPathPrefix

This must be 1 or 2 characters. Any additional characters are ignored.

If rootPathSuffix doesn't accept parent paths with ../, that should be fixed.

I'm not sure about allowing longer rootPathPrefix strings. I don't immediately see any harm in it, but I'll look into it in the next few days.

Any thoughts on possible issues from either of these would be appreciated.

The PR #122 lift the 2 characters restriction

PR was merged