Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bobzhang/import-rescript-based-library
An example to show JS users can use Rescript based library without using ReScript
https://github.com/bobzhang/import-rescript-based-library
Last synced: 3 months ago
JSON representation
An example to show JS users can use Rescript based library without using ReScript
- Host: GitHub
- URL: https://github.com/bobzhang/import-rescript-based-library
- Owner: bobzhang
- Created: 2021-02-10T10:26:56.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-10T10:35:27.000Z (almost 4 years ago)
- Last Synced: 2024-08-04T01:26:49.750Z (5 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 15
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadME.md
Awesome Lists containing this project
- awesome-list - import-rescript-based-library
README
# Example using [ReScript](https://github.com/rescript-lang/rescript-compiler) as a pure js library
[index.mjs](./index.mjs) is a word counting program.
It use the Belt.Map module from ReScript standard library.
You can run it via `node ./index.mjs`
You can also bundle it into [index.bundle.mjs](./index.bundle.mjs)
```
npx esbuild index.mjs --bundle --platform=node --outfile=index.bundle.mjs --minify-syntax --format=esm
```The great thing with Belt.Map libraries is that it is functional and support custom data type.
The experience could be improved in the future, e.g, generating typescript declarations.