cjs2es
Converts source of any CommonJS module to the ES module
Usage
; const cjsSource = `const modulename = require('some-module');console.log(modulename);module.exports = {foo: 'bar'}`; const esSource = ;
Copyright
Original idea is from here: https://github.com/sveltejs/svelte-repl/blob/master/src/workers/bundler/plugins/commonjs.js