Migrate plugin bundling to esbuild

Summary: With esbuild bundling all plugins takes a couple of seconds instead of 3-5 minutes with metro. As a result, we can stop including plugins into Flipper's bundle for development and always bundle them separately. It reduces complexity of our build pipeline and makes the dev build work more like our prod build. It also allows us to stop bundling flipper-server code and just compile it instead.

Reviewed By: lblasa

Differential Revision: D39262048

fbshipit-source-id: c4da0f2ea2807015d98e0d070349c39b2118e189
This commit is contained in:
Andrey Goncharov
2022-09-15 10:02:19 -07:00
committed by Facebook GitHub Bot
parent 819cb4342c
commit 94df830dfb
4 changed files with 170 additions and 132 deletions

View File

@@ -54,17 +54,6 @@ const argv = yargs
type: 'string',
alias: 'ou',
},
'output-sourcemap': {
description: 'File path for the sourcemap to be written. Optional.',
type: 'string',
alias: 'os',
},
'output-sourcemap-server-addon': {
description:
'File path for the server add-on sourcemap to be written. Optional.',
type: 'string',
alias: 'os',
},
})
.help()
.parse(process.argv.slice(1));
@@ -76,14 +65,9 @@ async function buildPlugin() {
const outputFileArg = argv.output;
const outputUnpackedArg = argv['output-unpacked'];
const minFlipperVersion = argv['min-flipper-version'];
const outputSourcemapArg = argv['output-sourcemap'];
const outputSourcemapServerAddOnArg = argv['output-sourcemap-server-addon'];
const packageJsonPath = path.join(pluginDir, 'package.json');
const packageJsonOverridePath = path.join(pluginDir, 'fb', 'package.json');
await runBuild(pluginDir, false, {
sourceMapPath: outputSourcemapArg,
sourceMapPathServerAddOn: outputSourcemapServerAddOnArg,
});
await runBuild(pluginDir, false);
const checksum = await computePackageChecksum(pluginDir);
if (previousChecksum !== checksum && argv.version) {
console.log(`Plugin changed. Packaging new version ${argv.version}...`);