{"id":25038,"library":"bs-platform","title":"ReScript Compiler","description":"ReScript (bs-platform) is a strongly typed language that compiles to efficient, readable JavaScript. This package provides the compiler, standard library (Stdlib, Belt), and build system (ninja-based). Current latest stable version is 12.2.0 (as of this entry), with v13 in alpha. Release cadence is roughly quarterly, with breaking changes in major versions. Key differentiators vs TypeScript: sound type system, no type errors at runtime, fast compilation, and seamless interop with JavaScript via special syntax and attributes. The package is primarily for tooling and compiler development; most users should use the `rescript` npm package or ReScript via the VSCode extension.","status":"active","version":"9.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/rescript-lang/rescript-compiler","tags":["javascript","ocaml","rescript","stdlib","functional programming"],"install":[{"cmd":"npm install bs-platform","lang":"bash","label":"npm"},{"cmd":"yarn add bs-platform","lang":"bash","label":"yarn"},{"cmd":"pnpm add bs-platform","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Since ReScript 9.0, the recommended way is via the 'rescript' package. The 'bs-platform' package is legacy and no longer updated for new ReScript versions.","wrong":"const Belt = require('bs-platform').Belt","symbol":"Belt","correct":"import Belt from 'rescript'"},{"note":"Js module is part of the standard library. Use `open Js;` in ReScript source files. For JavaScript consumers, the module is not exported as a package import.","wrong":"import * as Js from 'bs-platform'","symbol":"Js","correct":"open Js;"},{"note":"Intl module is part of the standard library. Use `open Intl;` in ReScript source files. Breaking changes in v13: Intl.Collator.compare returns Ordering.t (float) instead of int.","wrong":"import Intl from 'bs-platform'","symbol":"Intl","correct":"open Intl;"},{"note":"bs-platform is the legacy package name. Since v9, the recommended package is 'rescript'. Install 'rescript' for new projects.","wrong":"npm install bs-platform","symbol":"rescript","correct":"npm install rescript"}],"quickstart":{"code":"// Create a new ReScript project\nmkdir my-project\ncd my-project\nnpm init -y\nnpm install rescript\n\n// Create rescript.json with minimal config\ncat > rescript.json << 'EOF'\n{\n  \"name\": \"my-project\",\n  \"version\": \"0.1.0\",\n  \"sources\": {\n    \"dir\": \"src\",\n    \"subdirs\": true\n  },\n  \"package-specs\": {\n    \"module\": \"commonjs\",\n    \"in-source\": true\n  },\n  \"suffix\": \".bs.js\",\n  \"bs-dependencies\": []\n}\nEOF\n\nmkdir src\ncat > src/Demo.res << 'EOF'\nlet greeting = \"Hello, ReScript!\"\nlet add = (a: int, b: int) => a + b\n\nlet result = add(2, 3)\nJs.log(greeting)\nJs.log(result)\nEOF\n\n// Compile\nnpx rescript build\n\n// Run the output (src/Demo.bs.js)\nnode src/Demo.bs.js","lang":"javascript","description":"Create a minimal ReScript project, compile a simple script, and run the generated JavaScript."},"warnings":[{"fix":"Run 'npm install rescript' and update your imports and build config to use the 'rescript' package.","message":"The 'bs-platform' package is deprecated. Use the 'rescript' package instead.","severity":"deprecated","affected_versions":">=9.0.0"},{"fix":"Rename 'bsconfig.json' to 'rescript.json' and adjust the schema if needed.","message":"Since v13.0.0-alpha, 'bsconfig.json' is no longer supported. Use 'rescript.json'.","severity":"breaking","affected_versions":">=13.0.0-alpha"},{"fix":"Use 'npx rescript build' instead of 'npx rescript-legacy build'. Ensure your rescript.json is configured for the modern build system.","message":"Since v13.0.0-alpha, the legacy build system is removed. Only the modern build system is supported.","severity":"breaking","affected_versions":">=13.0.0-alpha"},{"fix":"Remove the radix argument from calls to Int.fromString and Float.fromString. Use parseInt for radix-based parsing.","message":"In v13.0.0-alpha, 'Int.fromString' and 'Float.fromString' use stricter number parsing and no longer accept an explicit radix argument.","severity":"breaking","affected_versions":">=13.0.0-alpha"},{"fix":"Replace '%external' with the appropriate ReScript binding syntax, e.g., using '@external' decorator.","message":"In v13.0.0-alpha, the deprecated '%external' extension has been removed.","severity":"breaking","affected_versions":">=13.0.0-alpha"},{"fix":"Use 'npx rescript build' instead of 'bsc' or 'bsb'. Update your rescript.json to the new schema.","message":"In v12.0.0, the build system changed fundamentally. The 'bsc' and 'bsb' commands are deprecated.","severity":"breaking","affected_versions":">=12.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Update to ReScript v12.2.0 or later. If you must stay on an older version, avoid matching empty dict/record patterns.","cause":"Pattern matching on empty dict/record patterns in older versions.","error":"Fatal error: Parmatch.all_record_args"},{"fix":"Install the 'rescript' package and use 'require('rescript')' or adjust your build pipeline to use the 'rescript' package instead.","cause":"Trying to require or import 'bs-platform' after it has been deprecated and possibly not installed.","error":"Cannot find module 'bs-platform'"},{"fix":"Update to v12.0.1 or later where this is fixed. If you cannot update, refactor large unboxed variants.","cause":"A bug in ReScript v12.0.0 that caused exponential time/memory usage.","error":"exponential compilation blowup with large unboxed variants and dict pattern matching"},{"fix":"Update your code to handle Ordering.t (float) or use the previous version if you depend on int.","cause":"Breaking change in v13.0.0-alpha: the return type changed from int to Ordering.t (float).","error":"Intl.Collator.compare: expected int, got float"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}