diff --git a/scripts/build/build.js b/scripts/build/build.js index 9ff364c58c6..c8b670a8c0e 100644 --- a/scripts/build/build.js +++ b/scripts/build/build.js @@ -85,6 +85,10 @@ async function build() { async function buildPackage(packageName /*: string */, prepack /*: boolean */) { try { + process.stdout.write( + `${packageName} ${styleText('dim', '.').repeat(72 - packageName.length)} `, + ); + const {emitTypeScriptDefs} = getBuildOptions(packageName); const entryPoints = await getEntryPoints(packageName); @@ -98,10 +102,6 @@ async function buildPackage(packageName /*: string */, prepack /*: boolean */) { !entryPoints.has(file.replace(/\.js$/, '.flow.js')), ); - process.stdout.write( - `${packageName} ${styleText('dim', '.').repeat(72 - packageName.length)} `, - ); - // Build regular files for (const file of files) { await buildFile(path.normalize(file), { @@ -299,6 +299,15 @@ async function getEntryPoints( continue; } + if (target.startsWith('./' + BUILD_DIR + '/')) { + throw new Error( + `Found ./${BUILD_DIR}/* entry in package.json exports for ` + + `${packageName}. This is either a misconfiguration, or the ` + + `prepack script was previously run and the package.json state ` + + `is dirty. Please re-run against a clean working copy.`, + ); + } + if (target.includes('*')) { console.warn( `${styleText('yellow', 'Warning')}: Encountered subpath pattern ${subpath}` +