diff --git a/packages/framework-tools/src/buildDefaults.ts b/packages/framework-tools/src/buildDefaults.ts index 3f6222a14af5..d292442b6d74 100644 --- a/packages/framework-tools/src/buildDefaults.ts +++ b/packages/framework-tools/src/buildDefaults.ts @@ -71,7 +71,15 @@ export async function build({ ...buildOptions, }) - await fs.writeJSON(path.join(cwd, metafileName), result.metafile, { - spaces: 2, - }) + if (result.metafile) { + await fs.writeJSON(path.join(cwd, metafileName), result.metafile, { + spaces: 2, + }) + } else { + console.warn("No metafile found in esbuild's result.") + console.warn( + 'This is unexpected and probably means something is wrong with the ' + + 'build.', + ) + } }