{"id":25064,"library":"cherry-cljs","title":"Cherry CLJS","description":"Cherry is an experimental ClojureScript-to-ES6 module compiler that outputs readable, source-mapped .mjs files. It aims to reduce friction between ClojureScript and JavaScript tooling by producing ES6 modules that can be used directly with Node.js, Vite, and other modern JS toolchains. Unlike the official ClojureScript compiler, Cherry does not depend on Google Closure and is distributed as an NPM package. It supports macros, REPL, async/await, JSX via #jsx, and JS object destructuring. Version 0.5.34 is the latest; the project is experimental and not recommended for production use, with many bugs and frequent breaking changes.","status":"active","version":"0.5.34","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install cherry-cljs","lang":"bash","label":"npm"},{"cmd":"yarn add cherry-cljs","lang":"bash","label":"yarn"},{"cmd":"pnpm add cherry-cljs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides ClojureScript-compatible persistent data structures","package":"mori","optional":false}],"imports":[{"note":"Default export is not available; cherry is a named export.","wrong":"import cherry from 'cherry-cljs'","symbol":"cherry","correct":"import { cherry } from 'cherry-cljs'"},{"note":"Only ESM imports are supported. compileString is a named export from the main package.","wrong":"const compileString = require('cherry-cljs/compileString')","symbol":"compileString","correct":"import { compileString } from 'cherry-cljs'"},{"note":"cljs.core functionality is bundled in the main 'cherry-cljs' package as a named export 'core'.","wrong":"import * as core from 'cherry-cljs/core'","symbol":"cljs.core","correct":"import { core } from 'cherry-cljs'"}],"quickstart":{"code":"mkdir cherry-test && cd cherry-test\nnpm init -y\nnpm install cherry-cljs@latest\ncat > example.cljs << 'EOF'\n(ns example\n  (:require [\"fs\" :as fs]\n            [\"url\" :refer [fileURLToPath]]))\n\n(prn (fs/existsSync (fileURLToPath js/import.meta.url)))\n\n(defn foo [{:keys [a b c]}]\n  (+ a b c))\n\n(js/console.log (foo {:a 1 :b 2 :c 3}))\nEOF\nnpx cherry run example.cljs","lang":"clojurescript","description":"Compile and run a minimal ClojureScript file that uses Node.js fs and url modules."},"warnings":[{"fix":"Pin a specific version and test thoroughly before upgrading.","message":"Cherry is experimental and not recommended for production; APIs and output may change without notice.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Ensure runtime version matches compiler version, or use lockfile.","message":"Compiled output depends on 'cherry-cljs' runtime module. Breaking changes in the runtime may break compiled code.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"Use `import { core } from 'cherry-cljs'` instead.","message":"The `cherry-cljs/core` subpath import was replaced by named export `core`.","severity":"deprecated","affected_versions":">=0.3.0"},{"fix":"Refer to issue tracker for known incompatibilities; consider Squint for CLJS syntax to JS compilation.","message":"Cherry does not support all ClojureScript features, e.g., some macros or interop patterns.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Update .cljs files to use the new require syntax: `(:require [\"mod\" :as mod])` instead of `(:require [\"mod\" :refer [foo]])` for default imports.","message":"Version 0.5.0 changed how require of JS modules works: now uses JavaScript import syntax in output.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Use `npx cherry run --debug` for better error messages, but expect occasional mismatches.","message":"Source maps may not always be accurate in development mode due to experimental nature.","severity":"gotcha","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install cherry-cljs@latest`. Ensure import uses named export: `import { cherry } from 'cherry-cljs'`.","cause":"Package is not installed or import path is incorrect.","error":"Error: Cannot find module 'cherry-cljs' when trying to import"},{"fix":"Use `import { cherry } from 'cherry-cljs'` instead of `import cherry from 'cherry-cljs'`.","cause":"Wrong import style: default import used but package only exports named exports.","error":"SyntaxError: The requested module 'cherry-cljs' does not provide an export named 'default'"},{"fix":"Use new syntax: `(:require [\"module-name\" :as alias])` or `(:require [\"module-name\" :refer [symbol]])`.","cause":"Using old ClojureScript require syntax for JS modules.","error":"CompilerException: Unsupported :require syntax","affected_versions":">=0.5.0"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}