lxieyang / chrome-extension-boilerplate-react

A Chrome Extensions boilerplate using React 18 and Webpack 5.
MIT License
3.42k stars 1.07k forks source link

Builds fail silently #185

Open nothingrandom opened 10 months ago

nothingrandom commented 10 months ago

If there is a path error (eg change a directory name in a clean build) or a Typescript error running npm run build will fail, completely silently, with a success code.

Meanwhile, npm run start will provide some form of erroring.

Would be really useful (basically essential) for pipelines to start getting build to error properly and provide exit 1

Romstar commented 10 months ago

I have this issue as well. It happens with TypeScript, not sure if it happens with JSX as well.

Romstar commented 10 months ago

here is the link in webpack's docs. Apparently the err object does not contain the error so this repo needs to be updated.

webpack(config, (err, stats) => {
  if (err || stats.hasErrors()) {
    console.log('stats:', stats.toString({ colors: true }));
    // ...
  }
  // Done processing
});

https://webpack.js.org/api/node/#:~:text=The%20err%20object%20will%20not%20include%20compilation%20errors.%20Those%20must%20be%20handled%20separately%20using%20stats.hasErrors()%2C%20which%20will%20be%20covered%20in%20detail%20in%20the%20Error%20Handling%20section%20of%20this%20guide.%20The%20err%20object%20will%20only%20contain%20webpack%2Drelated%20issues%2C%20such%20as%20misconfiguration%2C%20etc.

Romstar commented 10 months ago

Created a PR above, hopefully he approves of it. There is an attached screenshot for the failed build error.