Felt is an on-demand bundler designed for modern JavaScript (ES6 and beyond, typically transpiled via Buble/Rollup) and CSS (CSS Next), serving primarily as a development middleware or a static asset exporter. Currently at version 0.3.2, it requires Node.js 6 or above to run. The package offers three main modes of operation: a standalone CLI web server for quick local development, an Express.js middleware for integration into existing Node.js applications, and a static file exporter for pre-compiling assets for deployment. Its core functionality is highly extensible through 'recipes' and a plugin architecture, exemplified by modules like `felt-rollup`, which allows developers to define custom handler logic for different file types. This on-demand compilation approach is a key differentiator, focusing on speed during development rather than exhaustive pre-bundling.
npm install feltVerified import paths — ran on the pinned version, not inferred.
Integrates Felt as an on-demand ES6/CSS bundler middleware with an Express.js server.
Ensure your project or file where Felt is used operates in a CommonJS context (e.g., by using `.cjs` extension or `"type": "commonjs"` in package.json) and use `require()` syntax. If ESM is required, consider a CJS-to-ESM wrapper or alternative tooling.
Always install a recipe (e.g., `npm install felt-recipe-minimal`) or define custom handlers in your `felt.config.js` file, ensuring all necessary bundler plugins (e.g., `felt-rollup`, `rollup-plugin-buble`) are also installed.
Ensure your Node.js environment is at least version 6.x. For newer Node.js versions, test thoroughly and be prepared for potential dependency conflicts or deprecation warnings related to older build tools.
For production deployments, consider using Felt's `--export` option to pre-compile and serve static assets, or implement aggressive caching strategies on your server to mitigate compilation overhead.
Install the required recipe: `npm install felt-recipe-minimal` or `npm install -g felt felt-recipe-minimal` if using the CLI globally.
Change the port Felt uses with the `--port` CLI option (e.g., `felt --port 3333`) or by setting the `port` option in your `felt.config.js`.
Ensure your Node.js environment and file types are correctly configured for CommonJS (`.js` files without `"type": "module"` in package.json, or `.cjs` files) when using Felt, as it is a CommonJS library.