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.
npm install microbundle-crlVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates setting up `package.json` for a simple React library and a minimal component, then building it using `microbundle-crl`.
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.
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.
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.
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.
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`.
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`.
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).No dependency data recorded yet.