Skip to content

Commit

Permalink
fix(pv-scripts): fixed issue where prod-build process was not finished
Browse files Browse the repository at this point in the history
  • Loading branch information
friewerts committed Apr 29, 2024
1 parent 1eb82f7 commit 7af5db2
Showing 1 changed file with 22 additions and 29 deletions.
51 changes: 22 additions & 29 deletions packages/pv-scripts/scripts/prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,36 +77,29 @@ function webpackBuild(webpackConfig) {
});
}

prepareWebpackConfig("production")
.then((webpackConfig) => {
return webpackBuild(webpackConfig);
})
.then(
({ warnings }) => {
if (warnings.length) {
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.`
);
} else {
console.log(chalk.green("Compiled successfully.\n"));
}
},
(err) => {
console.log(chalk.red("Failed to compile.\n"));
printBuildError(err);
const buildProduction = async () => {
try {
const webpackConfig = await prepareWebpackConfig("production");
const { warnings } = await webpackBuild(webpackConfig);

process.exit(1);
if (warnings.length) {
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.`
);
} else {
console.log(chalk.green("Compiled successfully.\n"));
}
)
.catch((err) => {
console.log("sss");
process.exit(0);
} catch (err) {
console.log(chalk.red("Failed to compile.\n"));
printBuildError(err);

if (err && err.message) {
console.log(err.message);
}
process.exit(1);
});
}
};

buildProduction();

0 comments on commit 7af5db2

Please sign in to comment.