Skip to content

[api-extractor] crash when used with TS 4.7.2 moduleResolution Node16 #3433

Description

Summary

It seems that adding moduleResolution with a setting of Node16 to the tsconfig.json file causes @microsoft/api-extractor to fail every time. The error is as follows:

ERROR: Internal Error: getResolvedModule() could not resolve module name "./foo/bar.js"
/Users/johndoe/Documents/code/myrepo/my-package/dist/dts/index.d.ts:1:1
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
error Command failed with exit code 1.

This is blocking us from shipping our major new library versions.

Repro steps

I've got a branch that demonstrates the issue here:

https://github.com/microsoft/fast/tree/users/eisenbergeffect/fast-element-utilities

Simply pull that down and run yarn in the root. You will see an error similar to the above.

Details

I've tried many combinations of settings, but the only thing that seems to make the error go away is not using the Node16 setting. Unfortunately, this is required for some of our packages since they leverage package.jsonexports. You can switch the fast-element package to Node to get it working but then you will observe the problem in fast-foundation (which requires Node16 because it leverages package exports from fast-element).

I have discussed this briefly with a member of the TS team and they suspect that api-extractor may be using some undocumented APIs, specifically getResolvedModule.

Standard questions

QuestionAnswer
@microsoft/api-extractor version?7.24.1
Operating system?Mac
API Extractor scenario?rollups (.d.ts)
Would you consider contributing a PR?Yes
TypeScript compiler version?4.7.2
Node.js version (node -v)?16.14.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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