Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (process.env.CI && stats.compilation.warnings.length) {
// eslint-disable-next-line max-len
printErrors(
'Failed to compile. When process.env.CI = true, warnings are treated as failures. Most CI servers set this automatically.',
stats.compilation.warnings,
);
process.exit(1);
}
console.log(chalk.green('Compiled successfully.'));
console.log();
console.log('File sizes after gzip:');
console.log();
printFileSizesAfterBuild(stats, previousFileSizes);
console.log();
console.log(`The ${chalk.cyan(parts.PATHS.build)} folder is ready to be deployed.`);
callback();
});
}
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(warnings.join('\n\n'));
console.log(
'\nSearch for the ' +
chalk.underline(chalk.yellow('keywords')) +
' to learn more about each warning.'
);
console.log(
'To ignore, add ' + chalk.cyan('// eslint-disable-next-line') + ' to the line before.\n'
);
} else {
console.log(chalk.green('Compiled successfully.\n'));
}
console.log('File sizes after gzip:\n');
printFileSizesAfterBuild(
stats,
previousFileSizes,
paths.appBuild,
WARN_AFTER_BUNDLE_GZIP_SIZE,
WARN_AFTER_CHUNK_GZIP_SIZE
);
console.log();
}
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(warnings.join('\n\n'));
console.log(
`\nSearch for the ${chalk.underline(
chalk.yellow('keywords'),
)} to learn more about each warning.`,
);
console.log(
`To ignore, add ${chalk.cyan('// eslint-disable-next-line')} to the line before.\n`,
);
} else {
console.log(chalk.green('Compiled successfully.\n'));
}
console.log('File sizes after gzip:\n');
printFileSizesAfterBuild(
stats,
previousFileSizes,
paths.appBuild,
WARN_AFTER_BUNDLE_GZIP_SIZE,
WARN_AFTER_CHUNK_GZIP_SIZE,
);
console.log();
const appPackage = require(paths.packageJson);
const { publicUrl } = paths;
const { publicPath } = config.output;
const buildFolder = path.relative(process.cwd(), paths.appBuild);
printHostingInstructions(appPackage, publicUrl, publicPath, buildFolder);
},
err => {
console.log(
'\nSearch for the ' +
chalk.underline(chalk.yellow('keywords')) +
' to learn more about each warning.'
);
console.log(
'To ignore, add ' +
chalk.cyan('// eslint-disable-next-line') +
' to the line before.\n'
);
} else {
console.log(chalk.green('Compiled successfully.\n'));
}
console.log('File sizes after gzip:\n');
printFileSizesAfterBuild(stats, previousFileSizes, paths.appBuild);
console.log(
chalk.green(
'\nYou can upload stats.json into http://webpack.github.io/analyse/#hints\n'
)
);
},
err => {
console.log(
'\nSearch for the ' +
chalk.underline(chalk.yellow('keywords')) +
' to learn more about each warning.'
);
console.log(
'To ignore, add ' +
chalk.cyan('// eslint-disable-next-line') +
' to the line before.\n'
);
} else {
console.log(chalk.green('Compiled successfully.\n'));
}
console.log('File sizes after gzip:\n');
printFileSizesAfterBuild(stats, previousFileSizes, paths.appBuild);
console.log();
const appPackage = require(paths.appPackageJson);
const publicUrl = paths.publicUrl;
const publicPath = paths.servedPath;
const buildFolder = path.relative(process.cwd(), paths.appBuild);
printHostingInstructions(
appPackage,
publicUrl,
publicPath,
buildFolder,
useYarn
);
},
err => {
async function build(previousFileSizes) {
console.log('Building version', chalk.cyan(parts.appVersion().versionStr));
console.log(chalk.cyan('Creating an optimized production build...'));
console.log();
try {
const mainStats = await runWebpack(production);
handleErrors(mainStats);
console.log(chalk.green('Compiled successfully.'));
console.log();
console.log('File sizes after gzip:');
console.log();
printFileSizesAfterBuild(mainStats, previousFileSizes, parts.PATHS.build);
console.log();
console.log(`The ${chalk.cyan(parts.PATHS.build)} folder is ready to be deployed.`);
console.log();
console.log(chalk.cyan('Creating timetable-only build...'));
console.log();
const timetableOnlyStats = await runWebpack(timetableOnly);
handleErrors(timetableOnlyStats);
console.log(chalk.green('Compiled successfully.'));
console.log();
} catch (err) {
printErrors('Failed to compile.', [err]);
process.exit(1);
throw new Error(messages.errors[0]);
}
if (messages.warnings.length) {
console.log(chalk.yellow("Compiled with warnings."));
console.log();
console.log(messages.warnings.join("\n\n"));
} else {
console.log(chalk.green("Compiled successfully."));
}
console.log();
console.log("File sizes after gzip:");
console.log();
FileSizeReporter.printFileSizesAfterBuild(
stats,
previousFileSizes,
config.output.path,
WARN_AFTER_BUNDLE_GZIP_SIZE,
WARN_AFTER_CHUNK_GZIP_SIZE,
);
console.log();
});
},
function printResult({ stats, previousFileSizes, warnings }) {
if (warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(warnings.join('\n\n'));
} else {
console.log(chalk.green('Compiled successfully.\n'));
}
console.log('File sizes after gzip:\n');
printFileSizesAfterBuild(
stats,
previousFileSizes,
resolvePath('../build'),
WARN_AFTER_BUNDLE_GZIP_SIZE,
WARN_AFTER_CHUNK_GZIP_SIZE
);
console.log();
}