Skip to content

Commit

Permalink
Add section to README explaining settings to support ESM and CJS
Browse files Browse the repository at this point in the history
  • Loading branch information
jderochervlk committed May 18, 2024
1 parent fdd0174 commit f884af6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ Open it so it's available in the global scope.
}
```

## ESM and CJS
To use this library with CommonJS modules you should set the file extension in your project's `rescript.json` to `.res.js`, `.js`, `.res.cjs`, or `.cjs`. This will work with older versions of Node and most web projects using a bundler.

To use this library with EcmaScript modules you should set the file extension in your project's `rescript.json` to `.res.mjs`, or `.mjs`.
This will work with newer versions of Node and web projects using a modern bundler like Vite.

## What it looks like

All relevant standard library modules are designed to be available directly in
Expand Down

0 comments on commit f884af6

Please sign in to comment.