Open
Description
Environment
Component nativescript has 8.0.2 version and is up to date.
√ Component @nativescript/core has 8.0.7 version and is up to date.
× Component @nativescript/ios is not installed.
√ Component @nativescript/android has 8.0.0 version and is up to date.
Describe the bug
with NS 8 / Webpack 5 a typescript compilation error does not stop the build from producing an apk.
To Reproduce
Add a typescript error to the project, run ns build android
Expected behavior
The build should fail, however it appears to succeed.
Sample project
Additional context
As a workaround I've added this plugin to my webpack.config.js
class FailOnErrorPlugin {
apply(compiler) {
compiler.hooks.done.tap("FailOnError", (stats /* stats is passed as an argument when done hook is tapped. */) => {
if (stats.compilation.errors && stats.compilation.errors.length && process.argv.indexOf("--watch") == -1) {
console.log(stats.compilation.errors);
process.exit(1); // or throw new Error('webpack build failed.');
}
console.log("No Errors or in watch mode");
return stats;
});
}
}
configuring it with
webpack.chainWebpack(config => {
config.plugin("FailOnErrorPlugin").use(FailOnErrorPlugin, []);
});