create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

fix: Support Typescript module resolution `node16` (#12625)

Open demurgos opened this issue 3 years ago • 3 comments

The node16 module resolution for TypeScript adds native support for Node's ESM. In codebases with ESM libraries shared between Node and the frontend, this is the recommended module resolution for native ESM.

Unfortunately, setting the node16 module resolution currently breaks create-react-app. The reason is that imports need an explicit extension, and TypeScript requires to use the output module for resolution; even for bundlers. So foo.ts must be imported as foo.js.

To support this use case, Webpack 5.74.0 introduced the extensionAlias option. This commit updates the Webpack config used by react-scripts to use this new option and fix support for node16 module resolution in TypeScript.

Closes facebook/create-react-app#12625

demurgos avatar Jan 21 '23 19:01 demurgos

Hi @demurgos!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

facebook-github-bot avatar Jan 21 '23 19:01 facebook-github-bot

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

facebook-github-bot avatar Jan 21 '23 20:01 facebook-github-bot

Is this issue still active? What is it keeping open?

SRIKARREDDY-dotorg avatar Aug 06 '24 13:08 SRIKARREDDY-dotorg