Skip to content

Commit 1f5139a

Browse files
authored
Add section to README explaining settings to support ESM and CJS (#222)
1 parent fdd0174 commit 1f5139a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ Open it so it's available in the global scope.
7070
}
7171
```
7272

73+
## ESM and CJS
74+
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.
75+
76+
To use this library with EcmaScript modules you should set the file extension in your project's `rescript.json` to `.res.mjs`, or `.mjs`.
77+
This will work with newer versions of Node and web projects using a modern bundler like Vite.
78+
7379
## What it looks like
7480

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

0 commit comments

Comments
 (0)