Skip to content

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

@shawnmcknight

Description

@shawnmcknight

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions