Skip to content

Instantly share code, notes, and snippets.

@tbranyen
Last active August 20, 2018 04:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbranyen/99227943cbb1fd6de3b003ac8e6e5893 to your computer and use it in GitHub Desktop.
Save tbranyen/99227943cbb1fd6de3b003ac8e6e5893 to your computer and use it in GitHub Desktop.
WebApp Node API Example (Experimental JS Bundler) w/ Virtual Modules
const { webapp, register } = require('webapp');
async function main() {
const input = register('./input.js')`
const msg = 'Hello world!';
console.log(msg);
`;
const { source } = await webapp({
input,
// Ensure that no filesystem configuration files are consumed.
config: null,
// It is important to disable cache, to avoid writing out to the FS.
disableCache: true,
});
console.log(source.code);
}
main();
// const a="Hello world!";console.log(a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment