Skip to content

typescript v2.1.4 doesn't like empty files in config #405

Closed
@danfuzz

Description

@danfuzz

Line 49 of config.ts runs afoul of the tsconfig checker in v2.1.4 of the TypeScript compiler:

        configFile = {
            config: {
                compilerOptions: {},
                files: [], // <-------------- THIS LINE
            },
        };

https://github.com/TypeStrong/ts-loader/blob/master/src/config.ts#L49

In my project (https://github.com/danfuzz/quillex), I'm getting the error "error TS18002: The 'files' list in config file 'tsconfig.json' is empty." which I've tracked back to this. (Note: I currently work around this by pointing my project at an older version of typescript.)

If I add a dummy entry to the files list, then typescript stops complaining, and things seem to work as expected, e.g.:

        configFile = {
            config: {
                compilerOptions: {},
                files: ['i-really-hope-you-dont-have-a-file-with-this-name'],
            },
        };

I don't know if this is the best solution to the problem, nor if it causes some other problem that I just haven't noticed yet. For the record, totally removing the files binding causes a different error ("error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["node_modules","bower_components","jspm_packages"]'.").

typescript has an explicit error code and message for a specified-but-empty files list, so I'm guessing the change in behavior is intentional.

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