Bundle Runner
This package allows running a Webpack bundle in Node.js with optional sandboxed context. Useful for development, loading bundle from memory (HMR) and a consistent way of loading bundle between development and production environments.
✅ What sandboxing is for:
- Optional sandboxing using Node.js VM
- Mitigate script evaluation side-effects to global object
- Avoid unwanted shared state
- Avoid memory leaks during HMR
❌ What sandboxing is not for:
- Fully avoid side effects of evaluation
- A secure sandbox to run untrusted code
- High performance
Install
yarn add bundle-runner npm install bundle-runner
Usage
createBundle
CreateBundleOptions
Bundle Format
Input can be string (path to a .js
file or .json
file with bundle format) or directly bundle object with type of:
SourceMap Support
After creating bundle, a rewriteErrorTrace
utility is exposed which you can use to rewrite traces:
try catch err
Credits
Inspired by vue-server-renderer made by Evan You.
License
MIT