Skip to content

Commit 7a1963a

Browse files
authored
Docs: Document non-obvious parts of /demos/bundlers/build.mjs
Follows-up #1787.
1 parent e77a763 commit 7a1963a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

demos/bundlers/build.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ const rollupOutputs = [
5252
dir: tmpDir,
5353
entryFileNames: '[name].[format].js',
5454
format: 'umd',
55+
// For ".cjs" input files, Rollup assumes there are exports
56+
// (it doesn't look for module.exports). When combined with the UMD
57+
// output format, this means Rollup requires a name for UMD's
58+
// global variable. There are no exports in our input, so this
59+
// is merely storing an unused and empty object.
5560
name: 'UNUSED'
5661
}
5762
];
@@ -108,6 +113,9 @@ await (async function main () {
108113
console.log('... built ' + fileName);
109114

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

0 commit comments

Comments
 (0)