8000 NS 8 build continues & "succeeds" even if there is a TS complication error. · Issue #9436 · NativeScript/NativeScript · GitHub
[go: up one dir, main page]

Skip to content
NS 8 build continues & "succeeds" even if there is a TS complication error. #9436
Open
@jcassidyav

Description

@jcassidyav

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

testbreakbuild.zip

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, []);
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0