Update README.md

This commit is contained in:
Joseph Garrone 2023-05-30 17:20:32 +02:00 committed by GitHub
parent 06e2e5591a
commit c7d8998647
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,13 +119,12 @@ Regardless of the scenario you opt for you can always release for Deno using [De
Pursuing a fully compliant CJS + ESM distribution comes with caveats. It only works well if all your dependencies are adherent to the standard, a condition that [most modules fail to meet](https://github.com/mui/material-ui/issues/37335).
This method introduces the risk of your package being simultaneously loaded in both CJS and ESM in a single application. It also poses a similar risk to your dependencies.
This method introduces the risk of your package being simultaneously loaded in both CJS and ESM in a single node application. It also poses a similar risk to your dependencies.
Thus, proceed with this option only if it's necessary for your lazy imports to actually be lazy when your code runs on Node.js.
Thus, proceed with this option only if it's necessary for your lazy imports to actually be lazy when your code runs on Node.
- To transpile in ESM, use [`js2mjs`](https://github.com/garronej/js2mjs) to ensure your ESM distribution generated by TypeScript is fully compliant with the standard ([An external script should not be required for this!](https://github.com/microsoft/TypeScript/issues/18442)). [See Example](https://github.com/garronej/tsafe/blob/6d08839c3b0695edbc3443d21b256043cd98787b/package.json#L10-L12)
- Declare your exports using both `require` and `import`. [See Example](https://github.com/garronej/tsafe/blob/6d08839c3b0695edbc3443d21b256043cd98787b/package.json#L64-L78).
Checkout the full example with [tsafe](https://github.com/garronej/tsafe/tree/6d08839c3b0695edbc3443d21b256043cd98787b) (use the specifically this link, the current version doesn't release an
ESM distribution anymore, it doesn't need to).
@ -140,8 +139,6 @@ If you find your self thinking:
Just [start a discussion](https://github.com/garronej/ts-ci/discussions) or hit [my Twitter DM](https://twitter.com/GarroneJoseph) I'll be happy to provide further guidance.
# FAQ
<details>