Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

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.