misc: shim fs out of lightrider report generator bundle (#14098)
This commit is contained in:
Родитель
056e564e4c
Коммит
4574943041
|
@ -31,26 +31,21 @@ async function buildReportGenerator() {
|
|||
const bundle = await rollup({
|
||||
input: 'report/generator/report-generator.js',
|
||||
plugins: [
|
||||
rollupPlugins.inlineFs({verbose: Boolean(process.env.DEBUG)}),
|
||||
rollupPlugins.shim({
|
||||
[`${LH_ROOT}/report/generator/flow-report-assets.js`]: 'export default {}',
|
||||
'fs': 'export default {}',
|
||||
}),
|
||||
rollupPlugins.commonjs(),
|
||||
rollupPlugins.inlineFs({verbose: Boolean(process.env.DEBUG)}),
|
||||
],
|
||||
});
|
||||
|
||||
await bundle.write({
|
||||
file: 'dist/lightrider/report-generator-bundle.js',
|
||||
format: 'iife',
|
||||
format: 'umd',
|
||||
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() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче