webpack-sandboxed

node v8.17.0
version: 0.5.1
endpointsharetweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
require('node-libs-browser'); // explicit import for runkit.com const webpack = require('webpack'); const webpackSandboxed = require('webpack-sandboxed').default; async function main() { const code = `module.exports = () => 42;`; const sandbox = await webpackSandboxed(); const [bundle, stats] = await sandbox.run(code); const key = Object.keys(bundle)[0]; const compiled = bundle[key]; const exported = eval(compiled); return exported(); } main().then(console.log).catch(console.error);
Loading…

no comments

    sign in to comment