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

Unable to resolve paths to file in root folder beginning with "." (period/dot) #255

Closed
shawnmcknight opened this issue Jan 8, 2018 · 2 comments

Comments

@shawnmcknight
Copy link

If a file located in the root folder begins with a ., the resolver will not be able to locate it.

In my root folder (configured as './src'), I've got a file used for package configuration. In my case, the file is named .mvomrc.json, but the file name and extension both appear to be irrelevant to this issue in my testing. The only thing that appears to matter is that the file begins with a . and is located directly in the configured root folder.

The file can be imported using relative pathing both from within the directory as well as below it (i.e. ./.mvomrc.json or ../.mvomrc.json. It can be imported if the file is moved to a directory below the root (i.e. import stuff from 'subdirectory/.mvomrc.json'. I believe that when relative pathing is used then the module-resolver ignores it, which I also suspect might be the origin of my problem.

In the below code from resolvePath.js...

export default function resolvePath(sourcePath, currentFile, opts) {
  if (sourcePath[0] === '.') {
    return sourcePath;
}

...it appears to me that the module-resolver is not processing any file that begins with .. My guess is that the intention here is to throw out anything it believes to have a relative path, but that also throws out files which happen to begin with a . but are not intended to be a relative path.

I think this explains the issue relatively well, but I can whip up a test scenario if needed.

Thanks!

@shawnmcknight
Copy link
Author

I didn't see any open or closed issues for this, but I just happened to glance at #253 and I think it might be intended to resolve this same issue.

@a-x-
Copy link

a-x- commented Jan 23, 2018

jfyi, #253 had resolved

@tleunen tleunen closed this as completed Feb 5, 2018
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

3 participants