Skip to content

Allow missing baseUrl for TS 4.1+ #143

@jakebailey

Description

@jakebailey

TypeScript 4.1+ support paths without baseUrl. See:

Effectively, the paths become relative to the tsconfig.json file.

I'm testing a project with the new beta and baseUrl removed to get better auto-completion, but it appears this library (which is used by tsconfig-paths-webpack-plugin) requires baseUrl to be specified. I've even tried in the plugin to override baseUrl with . (which is pretty much what TS does), but since the plugin loads the config using this library and this library throws an error, the plugin doesn't get to the point where it could override the config.

Perhaps if the config has no baseUrl, it could be treated as a baseUrl of '.'? Or, change the result to allow undefined locations (and update the plugin)?

2022 EDIT: since it's been a long time and this hasn't been fixed, I had written my own little function to do everything needed for path mapping: https://github.com/microsoft/pyright/blob/169c6089b9914870c43622743c75844657cd9d70/build/lib/webpack.js#L90

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