All Projects β†’ shrynx β†’ Rollup Plugin Bucklescript

shrynx / Rollup Plugin Bucklescript

Licence: mit
rollup plugin for using bucklescript

Programming Languages

javascript
184084 projects - #8 most used programming language
reason
219 projects
bucklescript
41 projects

Labels

Projects that are alternatives of or similar to Rollup Plugin Bucklescript

Reason Design Patterns
πŸ—Ί An unofficial collection of "design patterns" for Reason and OCaml
Stars: ✭ 379 (+1547.83%)
Mutual labels:  reasonml
Learn Graphql
Real world GraphQL tutorials for frontend developers with deadlines!
Stars: ✭ 586 (+2447.83%)
Mutual labels:  reasonml
Rescript React Native
ReScript bindings for React Native
Stars: ✭ 802 (+3386.96%)
Mutual labels:  reasonml
Sketch Sh
Sketch.sh - Online Code Editor and ReasonML community
Stars: ✭ 403 (+1652.17%)
Mutual labels:  reasonml
Reasonablytyped
πŸ’  Converts Flow and TypeScript definitions to Reason interfaces
Stars: ✭ 525 (+2182.61%)
Mutual labels:  reasonml
Reason React
Stars: ✭ 636 (+2665.22%)
Mutual labels:  reasonml
Fnm
πŸš€ Fast and simple Node.js version manager, built in Rust
Stars: ✭ 6,102 (+26430.43%)
Mutual labels:  reasonml
Cra Template Rescript Lukin
πŸͺ Lukin CRA and ReScript Template
Stars: ✭ 18 (-21.74%)
Mutual labels:  reasonml
Query Json
Faster and simpler implementation of jq in Reason Native
Stars: ✭ 530 (+2204.35%)
Mutual labels:  reasonml
Gentype
Auto generation of idiomatic bindings between Reason and JavaScript: either vanilla or typed with TypeScript/FlowType.
Stars: ✭ 683 (+2869.57%)
Mutual labels:  reasonml
Reductive
Redux in Reason
Stars: ✭ 405 (+1660.87%)
Mutual labels:  reasonml
Brisk
✨Cross-platform set of tools for building native UIs with Reason/OCaml
Stars: ✭ 518 (+2152.17%)
Mutual labels:  reasonml
Reason Scripts
πŸ”° Create a ReasonML and React development environment
Stars: ✭ 644 (+2700%)
Mutual labels:  reasonml
Crra
Create Reason React App
Stars: ✭ 384 (+1569.57%)
Mutual labels:  reasonml
Avatar Generator
Persona Avatar Generator by Draftbit
Stars: ✭ 808 (+3413.04%)
Mutual labels:  reasonml
Reason Tools
Adds Reason to the browser
Stars: ✭ 366 (+1491.3%)
Mutual labels:  reasonml
Reason React Hacker News
hacker news mobile app made with reason react
Stars: ✭ 591 (+2469.57%)
Mutual labels:  reasonml
Reasonbizcharts
ReasonML binding for BizCharts https://bizcharts.net/products/bizCharts/demo
Stars: ✭ 23 (+0%)
Mutual labels:  reasonml
T Rex Runner Reason
πŸ¦– The T-Rex Runner Game from Chrome written in Reason
Stars: ✭ 16 (-30.43%)
Mutual labels:  reasonml
Oni2
Native, lightweight modal code editor
Stars: ✭ 6,704 (+29047.83%)
Mutual labels:  reasonml

rollup-plugin-bucklescript

dependency-status npm version

bucklescript compiler plugin for rollup.js

works with both ReasonML and OCaml

Usage

Installation

First install bs-platform in your project

npm i -D bs-platform

create a bsconfig.json for Bucklescript in the root directory of your project

and remember to specify "package-specs" as ["es6"], so that rollup can consume it.

{
  "name": "hello",
  "sources": ["src"],
  "bs-dependencies": ["reason-react"],
  "reason": {
    "react-jsx": 2
  },
  "package-specs": ["es6"],
  "refmt": 3
}

Finally, install rollup-plugin-bucklescript

npm i -D rollup-plugin-bucklescript

and add it to your rollup config.

import bucklescript from 'rollup-plugin-bucklescript'

export default {
  input: 'src/main.re',
  output: {
    file: 'dist/main.js',
    format: 'cjs',
  },
  plugins: [
    bucklescript()
  ],
}

Options

All the settings are taken from bsconfig.json, but few options can be overridden.

include and exclude

each a minimatch pattern, or array of minimatch patterns, which determines which files are complied by Bucklescript. By default all .re and .ml are included and all .rei and .mli are excluded.

module

To specify bucklescript output type for rollup to consume.

Note: Please check the Caveats section

...

plugins: [
  bucklescript({
    module: 'es6'
  })
]

inSource

To use bs-loader with bsb's in-souce builds, add the inSource option to your loader config:

...

plugins: [
  bucklescript({
    inSource: false
  })
]

cwd

This option specifies what directory to run bsb from.

...

plugins: [
  bucklescript({
    cwd: 'path/to/dir'
  })
]

showWarnings

Controls whether bsb compile warnings are shown. Defaults to true.

...

plugins: [
  bucklescript({
    showWarnings: true
  })
]

includeStandardLibrary

Note: This is an advance feature and may not work as intended Bucklescript comes with OCaml standard library complied to javascript. Choose whether to bundle functions from standard library. Defaults to true.

Examples

Check the examples folder in the github repo.

Caveats

Please use es6 for module option as rollup works only with es modules. But this breaks integration with with react, thought it can be easily solved by following the helpful error message provided by rollup.

or check the react example folder.

Acknowledgement

  • bs-loader - A webpack plugin for bucklescript, for providing bsb-js and read-bsconfig.
  • Reason team at facebook and all the project contributors for making ReasonML
  • @bobzhang and all contributors of bucklescript.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].