Skip to content

resolvePackageJsonExports false ignored in tsgo, works in v5.9 and v6 #2445

@freshp86

Description

@freshp86

Steps to reproduce

This is happening in the Chromium codebase, revealed as part of the effort to prepare for using tsgo (https://issues.chromium.org/issues/423789047).

Describing the problem briefly below and will follow-up with a minimal repro repository later on if the following is not clear. (Update: See minimal repro at https://github.com/freshp86/tsgo-repro-issue-2445)

When using tsgo, "resolvePackageJsonExports": false seems to be ignored, resulting in incorrect import URLs showing up in generated definition files (using "moduleResolution": "NodeNext"), which in turn causes other projects that consume these definition files (and don't use "skipLibCheck": true) to fail with error TS2307: Cannot find module '...' or its corresponding type declarations.

Behavior with typescript@5.9

// contents of generated cr_action_menu.d.ts file
export declare class CrActionMenuElement extends CrLitElement {
     static get styles(): import("//resources/lit/v3_0/lit.rollup.js").CSSResultGroup;
     render(): import("//resources/lit/v3_0/lit.rollup.js").TemplateResult<1>;
  ...
}

Behavior with tsgo

// contents of generated cr_action_menu.d.ts file
export declare class CrActionMenuElement extends CrLitElement {
    static get styles(): import("@lit/reactive-element/css-tag.js").CSSResultGroup;
    render(): import("lit-html").TemplateResult<1>;
  ...
}

Note the import() paths appearing in the definition file, where tsgo behaves the same as-if "resolvePackageJsonExports": true was specified, unlike v5.9 and v6 preview.

Please let me know if a fully fledged repro example is necessary to understand the reported issue. Thanks!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions