Skip to content

Commit

Permalink
chore: add note about esm cjs interop optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Jun 8, 2024
1 parent 807f467 commit c35dbaa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/esm/hook/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ export const load: LoadHook = async (
* from the data: URL.
*
* This should pre-compile for the CJS loader to have a cache hit
* TODO: extract exports only?
*
* I considered extracting the CJS exports from esbuild via (0&&(module.exports={})
* to minimize the data URL size but this only works for ESM->CJS and not CTS files
* which are already in CJS syntax.
* In CTS, module.exports can be written in any pattern.
*/
const transformed = transformSync(
code,
Expand Down

0 comments on commit c35dbaa

Please sign in to comment.