{"id":22176,"library":"rollup-plugin-prepack","title":"rollup-plugin-prepack","description":"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.","status":"maintenance","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/tunnckoCore/rollup-plugin-prepack","tags":["javascript","optimize","facebook","prepack","bundler","optimizer","bundles","pack","packager"],"install":[{"cmd":"npm install rollup-plugin-prepack","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-prepack","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-prepack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to run the Prepack optimizer","package":"prepack","optional":false}],"imports":[{"note":"The package exports a default function; named exports are not available. ESM import is preferred; require works but may cause issues with some bundlers.","wrong":"const prepack = require('rollup-plugin-prepack')","symbol":"default (prepack)","correct":"import prepack from 'rollup-plugin-prepack'"},{"note":"Named import does not exist; always use default import. The function is used in the 'plugins' array of Rollup config.","wrong":"import { prepack } from 'rollup-plugin-prepack'","symbol":"prepack (as Rollup plugin)","correct":"import prepack from 'rollup-plugin-prepack'"},{"note":"TypeScript users can import the type for options; not available as named export from the main entry in older versions.","wrong":"","symbol":"PluginOptions","correct":"import type { PluginOptions } from 'rollup-plugin-prepack'"}],"quickstart":{"code":"import prepack from 'rollup-plugin-prepack';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/optimized.js',\n    format: 'cjs'\n  },\n  plugins: [\n    prepack({\n      // Optional Prepack options\n      timeout: 10000,\n      mathRandomSeed: '0'\n    })\n  ]\n};","lang":"typescript","description":"Shows how to configure and use the plugin in a Rollup config with Prepack options."},"warnings":[{"fix":"Consider alternative optimizers like Google Closure Compiler or esbuild-plugin-prepack.","message":"Facebook Prepack is no longer actively maintained and may not work with modern JavaScript features.","severity":"deprecated","affected_versions":">=0.2.54"},{"fix":"Ensure input code is compatible with Prepack's supported subset, or use babel plugin to transpile beforehand.","message":"Prepack requires the input code to be compatible; it may throw errors for unsupported syntax (e.g., dynamic imports, eval).","severity":"gotcha","affected_versions":">=0.2.54"},{"fix":"Use import syntax or upgrade to Node 13+ with --experimental-modules (legacy).","message":"Version 1.0.0 switched from CommonJS to ESM-only exports; require() will fail.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run npm install rollup-plugin-prepack prepack --save-dev","cause":"Package not installed or mismatched peer dependency prepack not found.","error":"Cannot find module 'rollup-plugin-prepack'"},{"fix":"Check Prepack compatibility; validate input code with Prepack CLI standalone.","cause":"Prepack encountered unsupported syntax or errors in the input code.","error":"Error: Prepack failed with: ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}