Skip to content

Should "configFileName" be used as filename only or with path? #604

@mengxy

Description

@mengxy

I am using follow configuration:

{
  configFileName: path.join(__dirname, 'tsconfig.json'),
}

It works as expected in POSIX file systems. But in windows, 'ts-loader' cannot find the config file. Below function in config.js is broken in windows: https://github.com/TypeStrong/ts-loader/blob/master/src/config.ts#L76

function findConfigFile(compiler, searchPath, configFileName) {
    while (true) {
        var fileName = path.join(searchPath, configFileName);
        if (compiler.sys.fileExists(fileName)) {
            return fileName;
        }
        var parentPath = path.dirname(searchPath);
        if (parentPath === searchPath) {
            break;
        }
        searchPath = parentPath;
    }
    return undefined;
}

I just want to discuss that should we use configFileName as simple filename or path. If we use it as filename, then it's fine. But if we can use it as path, we should fixed this bug in windows file system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions