Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add section to README explaining settings to support ESM and CJS #222

Merged
merged 1 commit into from
May 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading