Skip to content

Stop NativeScript build if Webpack fails #10314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
insytes opened this issue Jun 14, 2023 · 1 comment · Fixed by #10327
Closed
2 tasks done

Stop NativeScript build if Webpack fails #10314

insytes opened this issue Jun 14, 2023 · 1 comment · Fixed by #10327
Labels
Milestone

Comments

@insytes
Copy link
Contributor

insytes commented Jun 14, 2023

Is your feature request related to a problem? Please describe.

I wish @nativescript/webpack would not discard errors from the configuration stage and instead halt the NativeScript build process.

I recently wrote a Webpack plugin to validate some env-vars that are required at runtime.

My attempts to raise an exception are visualised in the CLI however NativeScript proceeds with the build regardless.

Describe the solution you'd like

It would be nice if NativeScript could propagate the raised exception for a better control flow when handling errors.

Describe alternatives you've considered

Instead I find myself considering this hacky workaround. The try/catch block is for illustrative purposes only.

try {
  doSomethingThatMayThrow()
} catch (e) {
  process.exitCode = 1 // this feels wrong
  throw e // pointless anyway
}

Anything else?

I believe this is the offending code.

try {
configuration = require(configPath)(env);
} catch (err) {
console.log(err);
}
if (!configuration) {
console.log('No configuration!');
return;
}

Please accept these terms

@insytes insytes added the feature-pending-triage A new feature request pending triage to confirm validity. label Jun 14, 2023
@NathanWalker
Copy link
Contributor

Thanks for tracking this @insytes long time desire here; we’ll tackle this one likely for 9.0 but possibly sooner.

@NathanWalker NathanWalker added this to the 9.0 milestone Jun 16, 2023
@rigor789 rigor789 added bug and removed feature-pending-triage A new feature request pending triage to confirm validity. labels Jun 23, 2023
@insytes insytes closed this as completed Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants