{"id":21940,"library":"rollup-plugin-bucklescript","title":"rollup-plugin-bucklescript","description":"A Rollup plugin that integrates with the BuckleScript compiler to bundle ReasonML and OCaml code into JavaScript. Version 0.7.0 is the latest stable release (last updated in 2020). It works by running bsb during the build, consuming compiled ES6 modules. Key differentiators include minimal configuration (reads bsconfig.json), support for in-source builds, and options to control warnings and standard library inclusion. Compared to webpack's bs-loader, it fits the Rollup ecosystem better for library authors. Maintenance is intermittent; the repo has low activity.","status":"maintenance","version":"0.7.0","language":"javascript","source_language":"en","source_url":"https://github.com/shrynx/rollup-plugin-bucklescript","tags":["javascript","bucklescript","rollup","reason","reasonML"],"install":[{"cmd":"npm install rollup-plugin-bucklescript","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-bucklescript","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-bucklescript","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency; the actual BuckleScript compiler must be installed separately.","package":"bs-platform","optional":false}],"imports":[{"note":"This package is ESM-only and does not support require(). Use the default import in rollup.config.js which is already ESM.","wrong":"const bucklescript = require('rollup-plugin-bucklescript')","symbol":"default","correct":"import bucklescript from 'rollup-plugin-bucklescript'"},{"note":"The package exports a single function via default export. Named destructuring will not work.","wrong":"const { bucklescript } = require('rollup-plugin-bucklescript')","symbol":"bucklescript","correct":"import bucklescript from 'rollup-plugin-bucklescript'"},{"note":"Named import is incorrect. The default export is the plugin function.","wrong":"import { bucklescript } from 'rollup-plugin-bucklescript'","symbol":"bucklescript","correct":"import bucklescript from 'rollup-plugin-bucklescript'"}],"quickstart":{"code":"// rollup.config.js\nimport bucklescript from 'rollup-plugin-bucklescript';\n\nexport default {\n  input: 'src/main.re',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'cjs'\n  },\n  plugins: [\n    bucklescript()\n  ]\n};","lang":"javascript","description":"Shows basic Rollup configuration to compile a ReasonML file (main.re) using the plugin."},"warnings":[{"fix":"Add '\"package-specs\": [\"es6\"]' to bsconfig.json.","message":"Must set 'package-specs' in bsconfig.json to 'es6' for Rollup to consume ES modules.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Check the react example in the repo for workarounds.","message":"If using ReasonReact, using 'es6' module format can break JSX compilation; follow Rollup error messages to add aliases.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider using ReScript and its official build tools.","message":"BuckleScript is in maintenance mode; the project encourages migration to ReScript.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Ensure bs-platform is installed as a devDependency and bsconfig.json is valid.","message":"Plugin runs bsb during build; bsb must be installed and configured correctly.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev rollup-plugin-bucklescript'.","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'rollup-plugin-bucklescript'"},{"fix":"Run 'npm install --save-dev bs-platform'.","cause":"Peer dependency bs-platform is missing.","error":"Error: [BABEL] unknown: Cannot find module 'bs-platform'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}