Skip to content

Commit

Permalink
Docs: Document non-obvious parts of /demos/bundlers/build.mjs
Browse files Browse the repository at this point in the history
Follows-up #1787.
  • Loading branch information
Krinkle authored Jul 31, 2024
1 parent e77a763 commit 7a1963a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions demos/bundlers/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ const rollupOutputs = [
dir: tmpDir,
entryFileNames: '[name].[format].js',
format: 'umd',
// For ".cjs" input files, Rollup assumes there are exports
// (it doesn't look for module.exports). When combined with the UMD
// output format, this means Rollup requires a name for UMD's
// global variable. There are no exports in our input, so this
// is merely storing an unused and empty object.
name: 'UNUSED'
}
];
Expand Down Expand Up @@ -108,6 +113,9 @@ await (async function main () {
console.log('... built ' + fileName);

if (fileName.endsWith('.cjs.js')) {
// Skip the CJS output format when testing in browsers
// (depends on require+module.exports). These are
// tested in Node.js by /demos/bundlers.js instead.
continue;
}

Expand Down

0 comments on commit 7a1963a

Please sign in to comment.