Skip to content

Regression in v0.19 when using relative imports and paths from tsconfig #3354

Closed
@andyvanee

Description

I believe this may be related to other issues, but haven't seen a minimal reproduction expressed elsewhere:

Expected output - v0.18.20 processes relative import correctly

Regression - v0.19 resolves the relative import incorrectly

The most relevant pieces to this reproduction are:

  1. Including a wildcard in compilerOptions.paths
  2. Using a relative import which could be resolved by a path-relative import
{
  "compilerOptions": {
    "paths": {
      "*": ["web/*"]
    }
}
// web/bar/foo/index.ts
// This relative import is problematic in v0.19 since it resolves to `web/foo` rather than `web/bar/foo`
export {foo} from './foo'

The output in v0.19 translates the example into a recursive function since web/bar/foo/index.ts is masked by web/foo.ts

// web/foo.ts
function foo() {
  console.log("web/foo");
  foo();                                  // <- this is the wrong function reference
}

// entry.ts
foo();

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions