
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@gaearon/prepack
Advanced tools
Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.

Prepack is a partial evaluator for JavaScript. Prepack rewrites a JavaScript bundle, resulting in JavaScript code that executes more efficiently. For initialization-heavy code, Prepack works best in an environment where JavaScript parsing is effectively cached.
See the official prepack.io website for an introduction and an interactive REPL playground.
Install the CLI via npm,
$ npm install -g prepack
Or if you prefer yarn, make sure you get yarn first,
$ npm install -g yarn
and then install the Prepack CLI via yarn:
$ yarn global add prepack
You may need to prepend (pun intended!) the command with sudo in some cases.
To compile a file and print the output to the console:
$ prepack script.js
If you want to compile a file and output to another file:
$ prepack script.js --out script-processed.js
Detailed instructions and the API can be found at Prepack CLI: Getting Started
The following are a few plugins to other tools. They have been created and are maintained separately from Prepack itself. If you run into any issues with those plugins, please ask the plugin maintainers for support.
git submodule initgit submodule update --inityarnNote: For development work you really need yarn, as many scripts require it.
yarn buildyarn watch in the background to just compile changed files on the fly.yarn lintyarn flowyarn build or yarn watchyarn testYou can run individual test suites as follows:
yarn test-serializeryarn test-test262yarn build or yarn watchyarn replGet the code
Make sure the code is built, either by running yarn build or yarn watch.
Have a JavaScript file handy that you want to prepack, for example:
echo "function hello() { return 'hello'; } function world() { return 'world'; } s = hello() + ' ' + world();" >/tmp/sample.js
cat /tmp/sample.js | yarn prepack
Try --help for more options.
Instead of building, linting, type checking, testing separately, the following does everything together:
yarn validate
The content for prepack.io resides in the website directory of this repository. To make changes, submit a pull request, just like for any code changes.
In order to run the website locally at localhost:8000:
yarn build-bundle && mv prepack.min.js website/jspython -m SimpleHTTPServer (Python 2) or python -m http.server (Python 3) from the website/ directoryFor more information about contributing pull requests and issues, see our Contribution Guidelines.
Prepack is BSD-licensed. We also provide an additional patent grant.
FAQs
Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.
The npm package @gaearon/prepack receives a total of 7 weekly downloads. As such, @gaearon/prepack popularity was classified as not popular.
We found that @gaearon/prepack demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.