Registry / web-framework / microbundle-crl

microbundle-crl

JSON →
library0.13.11jsnpmunverified

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-crl
INSTALL
IMPORT
SIG · MICROBUNDLE-CRL
M
microbundle-crl
web-frameworkjavascriptv0.13.11
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

microbundle
npm install -D microbundle-crl # then run via package.json script: "build": "microbundle"
import microbundle from 'microbundle-crl'
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.
source
{ "source": "src/index.js" }
{ "input": "src/index.js" }
Used in package.json to specify the primary source file for bundling. It is the preferred input configuration.
main
{ "main": "dist/index.js" }
{ "cjs": "dist/index.js" }
Defines the output path for the CommonJS (Node.js) bundle. This is a standard package.json field.
module
{ "module": "dist/index.mjs" }
{ "module": "dist/index.js" }
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.

This quickstart demonstrates setting up `package.json` for a simple React library and a minimal component, then building it using `microbundle-crl`.

{ "name": "my-react-lib", "version": "1.0.0", "source": "src/index.js", "main": "dist/index.js", "module": "dist/index.mjs", "unpkg": "dist/index.umd.js", "scripts": { "build": "microbundle", "dev": "microbundle watch" }, "devDependencies": { "microbundle-crl": "^0.15.1" } } // src/index.js import React from 'react'; export const MyComponent = ({ greeting }) => { const message = `Hello, ${greeting || 'World'} from MyComponent!`; return <div>{message}</div>; }; export const anotherFunction = (a, b) => a + b; console.log('My React Library loaded.');
microbundle --version
Debug
Known issues
gotchaThis 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.
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.
affects: >=0.13.0
breakingFor 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`.
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.
affects: >=0.15.0
gotchaWhen 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.
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.
affects: >=0.15.0 <0.15.1
gotchaThe `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.
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.
affects: >=0.13.0
Errors
Common errors & fixes
Command 'microbundle' not found
The `microbundle-crl` package is installed locally as a dev dependency but not globally or is not in the system's PATH.
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`.
Error: Could not resolve 'react' from...
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.
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`.
RollupError: 'default' is not exported by ...
Attempting to import a CommonJS module using ESM default import syntax, or a named export using default import.
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).
Upgrade
Version history
0.13.11latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
microbundle-crl — npm install microbundle-crl · libregistry