{"id":13542,"library":"microbundle-crl","title":"Microbundle CRL","description":"Microbundle-crl is a specialized fork of the popular zero-configuration JavaScript bundler, Microbundle, currently at version `0.15.1`. It is explicitly designed for React projects and serves as the core bundler for `create-react-library`. Powered by Rollup, this tool simplifies the bundling process for small JavaScript libraries by providing opinionated, sensible defaults and generating multiple output formats including CommonJS (CJS), Universal Module Definition (UMD), and ECMAScript Modules (ESM) with integrated Terser compression. Key differentiators of this fork include automatically configuring the `jsx` option to `React.createElement` and pre-integrating Babel plugins for legacy decorators and optional chaining, making it particularly well-suited for building React component libraries and applications utilizing state management solutions like MobX. The project maintains an active release cadence, mirroring upstream Microbundle updates while incorporating its specific React-centric features.","status":"active","version":"0.13.11","language":"javascript","source_language":"en","source_url":"https://github.com/developit/microbundle","tags":["javascript","bundle","rollup","micro library"],"install":[{"cmd":"npm install microbundle-crl","lang":"bash","label":"npm"},{"cmd":"yarn add microbundle-crl","lang":"bash","label":"yarn"},{"cmd":"pnpm add microbundle-crl","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"microbundle-crl is a CLI tool, not a library to be imported directly into JavaScript code. It's executed via npm scripts or directly from the command line.","wrong":"import microbundle from 'microbundle-crl'","symbol":"microbundle","correct":"npm install -D microbundle-crl\n# then run via package.json script: \"build\": \"microbundle\""},{"note":"Used in package.json to specify the primary source file for bundling. It is the preferred input configuration.","wrong":"{ \"input\": \"src/index.js\" }","symbol":"source","correct":"{ \"source\": \"src/index.js\" }"},{"note":"Defines the output path for the CommonJS (Node.js) bundle. This is a standard package.json field.","wrong":"{ \"cjs\": \"dist/index.js\" }","symbol":"main","correct":"{ \"main\": \"dist/index.js\" }"},{"note":"Defines the output path for the ECMAScript Module (ESM) bundle. Since v0.15.0, when `type` is 'commonjs' in package.json, ESM outputs use the `.mjs` extension. If `type` is 'module', `.js` is used.","wrong":"{ \"module\": \"dist/index.js\" }","symbol":"module","correct":"{ \"module\": \"dist/index.mjs\" }"}],"quickstart":{"code":"{\n  \"name\": \"my-react-lib\",\n  \"version\": \"1.0.0\",\n  \"source\": \"src/index.js\",\n  \"main\": \"dist/index.js\",\n  \"module\": \"dist/index.mjs\",\n  \"unpkg\": \"dist/index.umd.js\",\n  \"scripts\": {\n    \"build\": \"microbundle\",\n    \"dev\": \"microbundle watch\"\n  },\n  \"devDependencies\": {\n    \"microbundle-crl\": \"^0.15.1\"\n  }\n}\n// src/index.js\nimport React from 'react';\n\nexport const MyComponent = ({ greeting }) => {\n  const message = `Hello, ${greeting || 'World'} from MyComponent!`;\n  return <div>{message}</div>;\n};\n\nexport const anotherFunction = (a, b) => a + b;\n\nconsole.log('My React Library loaded.');","lang":"javascript","description":"This quickstart demonstrates setting up `package.json` for a simple React library and a minimal component, then building it using `microbundle-crl`."},"warnings":[{"fix":"Review the README and GitHub for the specific differences in default configurations. If these defaults are undesired, consider using the original `microbundle` or overriding specific CLI flags.","message":"This package is a custom fork (`-crl`) of the original `microbundle`. It includes specific defaults for React development, such as `jsx: 'React.createElement'` and `@babel/plugin-proposal-decorators` and `@babel/plugin-proposal-optional-chaining` enabled by default. Users expecting vanilla `microbundle` behavior should be aware of these pre-configurations.","severity":"gotcha","affected_versions":">=0.13.0"},{"fix":"Update your `package.json` `module` field to point to an `.mjs` file (e.g., `\"module\": \"dist/foo.mjs\"`). Ensure consumers of your library are aware of this change and adjust their import paths accordingly.","message":"For packages with `\"type\": \"commonjs\"` in their `package.json`, ESM output files (typically specified via the `module` field) will now use the `.mjs` extension. Previously, they might have used `.js`.","severity":"breaking","affected_versions":">=0.15.0"},{"fix":"Upgrade to `microbundle-crl@0.15.1` or newer, which includes a fix for this issue. If upgrading is not possible, ensure all critical CSS is referenced by your primary entry point.","message":"When bundling multiple entry points that reference different CSS files, only the CSS referenced by the *first* entry point may be correctly bundled and output. Subsequent entries' CSS might be omitted.","severity":"gotcha","affected_versions":">=0.15.0 <0.15.1"},{"fix":"Ensure your target environments support ES2017+ if shipping the `modern` bundle. The `module` field is generally preferred for modern ES Modules, and the `unpkg` or `main` fields for broader compatibility.","message":"The `modern` output format is enabled by adding a `modern` field to `package.json` (e.g., `\"modern\": \"dist/foo.modern.js\"`). This format produces more modern JavaScript syntax (ES2017+) that keeps useful optimizations for compression, but may not be compatible with older environments. The `module` field is now typically recommended for this output.","severity":"gotcha","affected_versions":">=0.13.0"}],"env_vars":null,"search_vec":"'0.15.1':22 'activ':127 'applic':116 'automat':85 'babel':96 'build':111 'bundl':48,143 'bundler':17,35 'cadenc':129 'centric':140 'chain':103 'cjs':66 'commonj':65 'compon':113 'compress':78 'configur':15,86 'core':34 'creat':38 'create-react-librari':37 'crl':2,5 'current':19 'decor':100 'default':58 'definit':69 'design':26 'differenti':80 'ecmascript':72 'esm':74 'explicit':25 'featur':141 'fork':9,83 'format':63 'generat':60 'includ':64,84 'incorpor':135 'integr':76,95 'javascript':16,52,142 'jsx':88 'key':79 'legaci':99 'librari':40,53,114,146 'like':121 'maintain':125 'make':104 'manag':119 'micro':145 'microbundl':1,4,18,132 'microbundle-crl':3 'mirror':130 'mobx':122 'modul':68,73 'multipl':61 'opinion':56 'option':89,102 'output':62 'particular':106 'plugin':97 'popular':12 'power':41 'pre':94 'pre-integr':93 'process':49 'project':29,124 'provid':55 'react':28,39,112,139 'react-centr':138 'react.createelement':91 'releas':128 'rollup':43,144 'sensibl':57 'serv':31 'simplifi':46 'small':51 'solut':120 'special':8 'specif':137 'state':118 'suit':109 'terser':77 'tool':45 'umd':70 'univers':67 'updat':133 'upstream':131 'util':117 'version':21 'well':108 'well-suit':107 'zero':14 'zero-configur':13","created_at":"2026-04-20T01:55:02.775807+00:00","updated_at":"2026-04-20T01:55:02.775807+00:00","problems":[{"fix":"Ensure `microbundle-crl` is listed in `devDependencies` in `package.json`. Run the command via `npm run <script-name>` (e.g., `npm run build`) or `npx microbundle`.","cause":"The `microbundle-crl` package is installed locally as a dev dependency but not globally or is not in the system's PATH.","error":"Command 'microbundle' not found"},{"fix":"If you intend to bundle React, use the `--no-external react` flag: `microbundle --no-external react`. For library development, ensure `react` and `react-dom` are correctly listed as `peerDependencies` in your `package.json`.","cause":"Microbundle-crl treats `react` as an external dependency by default for libraries. If you are building an application or need to bundle React itself, this can cause issues.","error":"Error: Could not resolve 'react' from..."},{"fix":"Adjust your import statement to use named imports (`import { namedExport } from 'module';`) or ensure the module explicitly provides a default export. For CommonJS modules, consider `import * as name from 'module';` or `import name = require('module');` (TypeScript).","cause":"Attempting to import a CommonJS module using ESM default import syntax, or a named export using default import.","error":"RollupError: 'default' is not exported by ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"microbundle","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/developit/microbundle","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/microbundle-crl","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}