Add blurb about configuring TypeScript for ESM resolution (#1330)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1330

This has been tripping folks up a bit. Add a blurb to the package README to call it out.

Reviewed By: cortinico

Differential Revision: D47370333

fbshipit-source-id: f07b2e4d0e23865e3554c7aaf6ec77dff71a7423
This commit is contained in:
Nick Gerleman
2023-07-12 15:43:10 -07:00
committed by Facebook GitHub Bot
parent 5310eb3cf7
commit 5bbaadfa54

View File

@@ -41,12 +41,15 @@ node.free();
For better performance and smaller packages, WebAssembly is preferred to asm.js where available. `yoga-layout` tries to provide the right default using [export maps](https://webpack.js.org/guides/package-exports/#conditional-syntax) so that platforms which can take advantage of WebAssembly use it by default. For better performance and smaller packages, WebAssembly is preferred to asm.js where available. `yoga-layout` tries to provide the right default using [export maps](https://webpack.js.org/guides/package-exports/#conditional-syntax) so that platforms which can take advantage of WebAssembly use it by default.
A specific entrypoint may be specified on platforms which do not understand export conditions. Different entrypoints are exposed to choose a flavor explicitly.
```ts ```ts
import {loadYoga} from 'yoga-layout/wasm-async'; import {loadYoga} from 'yoga-layout/wasm-async';
``` ```
## Using TypeScript
This package provides out-of-the-box TypeScript typings so long as `tsc` is configured to support ESM resolution. It is recommended to set `moduleResolution: 'bundler'` or `moduleResolution: node16` in your `tsconfig.json` according to your environment.
## Contributing ## Contributing