Registry / gcp / better-firebase-functions-rollup

better-firebase-functions-rollup

JSON →
library7.1.1jsnpmunverified

Rollup plugin for better-firebase-functions that enables per-function bundling with tree shaking for Firebase Cloud Functions. Current stable version is v7.1.1 (released April 2026) with active development and frequent releases. It discovers function files by executing the BFF entry point in build-discovery mode, reusing existing config (functionDirectoryPath, searchGlob, funcNameFromRelPath). Outputs one bundled chunk per function preserving the original directory layout. Supports TypeScript, ESM/CJS, and requires Rollup >=3. Key differentiator: it eliminates the need to duplicate glob configuration and automates function splitting without manual input.

npm install better-firebase-functions-rollup
INSTALL
IMPORT
SIG · BETTER-FIREBASE-FU
B
better-firebase-functions-rollup
gcpjavascriptv7.1.1
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 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

bffRollupPlugin
import { bffRollupPlugin } from 'better-firebase-functions-rollup'
const bffRollupPlugin = require('better-firebase-functions-rollup')
Named ESM export. CommonJS require will not work in Node >=20 with ESM module type.
bffRollupOutput
import { bffRollupOutput } from 'better-firebase-functions-rollup'
import bffRollupOutput from 'better-firebase-functions-rollup'
Named export, not default. Default import is undefined.
bffRollupPlugin (type)
import type { BffRollupPluginOptions } from 'better-firebase-functions-rollup'
import { BffRollupPluginOptions } from 'better-firebase-functions-rollup'
Type-only import to avoid runtime import error, especially in TypeScript's isolatedModules.

Configures Rollup with bffRollupPlugin to discover Firebase functions and bffRollupOutput to emit per-function chunks preserving source layout.

// file: rollup.config.ts import { resolve } from 'path'; import { bffRollupPlugin, bffRollupOutput } from 'better-firebase-functions-rollup'; // Runtime entry point (src/index.ts) should call exportFunctions() with config export default { input: resolve(__dirname, 'src/index.ts'), output: bffRollupOutput({ dir: resolve(__dirname, 'dist'), mainFileName: 'main.js', format: 'cjs', }), plugins: [ bffRollupPlugin({ entryPoint: resolve(__dirname, 'src/index.ts'), verbose: true, }), ], };
Debug
Known issues
breakingv6.0.0 dropped support for Node <14; engine requirement changed to >=20 in v7.0.0
fix
Upgrade to at least Node 20, and ensure npm >=11.10.0.
affects: >=6.0.0
breakingv5.0.0 changed default searchGlob to include both .js and .ts files, which may break setups expecting only .js files in the same directory
fix
Explicitly set searchGlob to '**/*.func.js' if you need to maintain previous behavior.
affects: >=5.0.0
gotchaPlugin requires a peer dependency of rollup >=3.0.0; using with rollup 2.x will silently fail or cause errors
fix
Ensure your project has rollup@3 or higher installed.
affects: >=7.0.0
deprecatedFUNCTION_NAME environment variable replaced by K_SERVICE in v3.3.1; the plugin now uses K_SERVICE internally
fix
If you override the function name logic, update to use K_SERVICE.
affects: >=3.3.1
gotchaIf entry point cannot be executed during build (e.g., due to side effects), build-discovery fails and fallback manual overrides must be provided
fix
Provide explicit functionDirectoryPath, searchGlob, and funcNameFromRelPath as fallback options in bffRollupPlugin.
affects: >=7.0.0
Errors
Common errors & fixes
Error: Cannot find module 'better-firebase-functions-rollup'
Package not installed or wrong import path
fix
Run: npm install -D better-firebase-functions-rollup
TypeError: bffRollupPlugin is not a function
Default import used instead of named import
fix
Change import to: import { bffRollupPlugin } from 'better-firebase-functions-rollup'
Error: rollup.config.ts must be a function or an object
Rollup config returned promise or invalid shape (common when using dynamic imports in config)
fix
Make sure config is synchronous and default export is the config object
Upgrade
Version history
7.1.1latest on npm
Audit
Dependencies
rolluprequiredPeer dependency required as a plugin for Rollup bundler
Agent activity
48 hits · last 30 days
node
44
OpenAI (training)
1
Resources
better-firebase-functions-rollup — npm install better-firebase-functions-rollup · libregistry