diff --git a/desktop/scripts/build-flipper-server-release.ts b/desktop/scripts/build-flipper-server-release.ts index 78bad2290..2b3c7685d 100644 --- a/desktop/scripts/build-flipper-server-release.ts +++ b/desktop/scripts/build-flipper-server-release.ts @@ -136,6 +136,18 @@ async function copyStaticResources(outDir: string) { } const target = path.join(outDir, 'static', 'defaultPlugins', plugin); if ((await fs.stat(source)).isDirectory()) { + // Verify it safe to strip the package down, does it have the + // typical flipper plugin structure? + const packageJson = JSON.parse( + await fs.readFile(path.join(source, 'package.json'), 'utf8'), + ); + if (packageJson.main !== 'dist/bundle.js') { + console.error( + `Cannot bundle plugin '${source}', the main entry point is '${packageJson.main}', but expected 'dist/bundle.js'`, + ); + continue; + } + // for plugins, only copy package.json & dist, to keep impact minimal await fs.copy( path.join(source, 'package.json'),