This test bundles two CommonJS modules: an entry module, and a second module it imports and uses.
const cjs = require('./cjs'); console.log(cjs);
module.exports = 'my string';
'my string' is logged.
Ideally, the string export from
cjs.js can be inlined where it is used in
index.js, removing the module's representation from the bundle entirely, and stripping away any module loading runtime. The contents of the bundle should essentially be
console.log('my string'), although this optimization may require a minifier.