Skip to content

Commit

Permalink
misc(build): fix lightrider report generator bundle (#14031)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Jun 8, 2022
1 parent 4cd7454 commit 7892760
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions build/build-lightrider-bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,22 @@ async function buildReportGenerator() {
[`${LH_ROOT}/report/generator/flow-report-assets.js`]: 'export default {}',
}),
rollupPlugins.commonjs(),
rollupPlugins.nodeResolve(),
rollupPlugins.inlineFs({verbose: Boolean(process.env.DEBUG)}),
],
});

await bundle.write({
file: 'dist/lightrider/report-generator-bundle.js',
format: 'umd',
format: 'iife',
name: 'ReportGenerator',
});
await bundle.close();

// Typically one would use `umd` to export to the window object, but for some reason rollup
// adds a `require('fs')` when used above, which errors in google3 build.
const outPath = `${LH_ROOT}/dist/lightrider/report-generator-bundle.js`;
fs.writeFileSync(outPath,
fs.readFileSync(outPath, 'utf-8') + '\nwindow.ReportGenerator = ReportGenerator;\n');
}

async function buildStaticServerBundle() {
Expand Down

0 comments on commit 7892760

Please sign in to comment.