Registry / devops / rollup-plugin-prepack

rollup-plugin-prepack

JSON →
library1.1.1jsnpmunverified

Rollup plugin that integrates Facebook Prepack (version 0.2.54+ peer dependency) to optimize JavaScript bundles at build time by running Prepack, a partial evaluator that produces smaller, faster code. Version 1.1.1 is the latest stable release; the project appears to be in maintenance mode with no recent commits. Key differentiator: enables ahead-of-time optimization via Prepack within the Rollup pipeline, unlike general minifiers.

npm install rollup-plugin-prepack
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-PREP
R
rollup-plugin-prepack
devopsjavascriptv1.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.

default (prepack)
import prepack from 'rollup-plugin-prepack'
const prepack = require('rollup-plugin-prepack')
The package exports a default function; named exports are not available. ESM import is preferred; require works but may cause issues with some bundlers.
prepack (as Rollup plugin)
import prepack from 'rollup-plugin-prepack'
import { prepack } from 'rollup-plugin-prepack'
Named import does not exist; always use default import. The function is used in the 'plugins' array of Rollup config.
PluginOptions
import type { PluginOptions } from 'rollup-plugin-prepack'
TypeScript users can import the type for options; not available as named export from the main entry in older versions.

Shows how to configure and use the plugin in a Rollup config with Prepack options.

import prepack from 'rollup-plugin-prepack'; export default { input: 'src/index.js', output: { file: 'dist/optimized.js', format: 'cjs' }, plugins: [ prepack({ // Optional Prepack options timeout: 10000, mathRandomSeed: '0' }) ] };
Debug
Known issues
deprecatedFacebook Prepack is no longer actively maintained and may not work with modern JavaScript features.
fix
Consider alternative optimizers like Google Closure Compiler or esbuild-plugin-prepack.
affects: >=0.2.54
gotchaPrepack requires the input code to be compatible; it may throw errors for unsupported syntax (e.g., dynamic imports, eval).
fix
Ensure input code is compatible with Prepack's supported subset, or use babel plugin to transpile beforehand.
affects: >=0.2.54
breakingVersion 1.0.0 switched from CommonJS to ESM-only exports; require() will fail.
fix
Use import syntax or upgrade to Node 13+ with --experimental-modules (legacy).
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'rollup-plugin-prepack'
Package not installed or mismatched peer dependency prepack not found.
fix
Run npm install rollup-plugin-prepack prepack --save-dev
Error: Prepack failed with: ...
Prepack encountered unsupported syntax or errors in the input code.
fix
Check Prepack compatibility; validate input code with Prepack CLI standalone.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
prepackrequiredpeer dependency required to run the Prepack optimizer
Agent activity
6 hits · last 30 days
node
6
Resources
rollup-plugin-prepack — npm install rollup-plugin-prepack · libregistry