question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't crash build on TSC errors

See original GitHub issue

Description

Usually I load these env variables to NOT crash the dev server on linting/tsc errors:

ESLINT_NO_DEV_ERRORS=true
TSC_COMPILE_ON_ERROR=true

But because these aren’t prefixed with NX_, they are ignored in nx, thus making the server crash on every little temporary error.

Motivation

Cut down dev time and frustration

Suggested Implementation

  1. introduce an easy way to override this crashing behavior, and have it be the default
  2. support non NX_ prefixed env variables
  3. Make this configuration available cross projects, i.e. I could globally set these env variables on all projects instead of manually setting them up for each new one.

Alternate Implementations

🤷‍♀️

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

1reaction
Ofadimancommented, Nov 5, 2022

I think that dev server does not crash but there is an overlay from webpack with error messages being displayed in the browser. I was able to disable the overlay by creating a custom webpack config according to this tutorial.

In my project.json I updated the targets.build.options.webpackConfig key to point to the created webpack config:

{
  ...
  "targets": {
    "build": {
      ...
      "options": {
        ...
        "webpackConfig": "apps/client/webpack.config.js"
      }
    },
    "serve": {...},
    "lint": {...},
    "test": {...}
  },
  "tags": []
}

My webpack config looks as follows:

const { merge } = require('webpack-merge')

module.exports = (config, _context) => {
  return merge(config, {
    devServer: {
      client: {
        // https://webpack.js.org/configuration/dev-server/#overlay
        overlay: {
          errors: false,
          warnings: false,
        },
      },
    },
  })
}

If I try to build the project via npx nx run client:build I still get typescript compilation errors so this change seems to affect only the development workflow.

0reactions
goldyluckscommented, Nov 25, 2022

Guys any progress here?

@Ofadiman any ideas?

Read more comments on GitHub >

github_iconTop Results From Across the Web

crash the build process on error · Issue #295 · ivogabe/gulp ...
When a typescript error is detected, gulp shouldn't exit with code 0, an error should be reported instead. Actual behavior: errors are displayed ......
Read more >
Create react app doesn't compile on typescript error
Save this question. Show activity on this post. I want typescript errors to appear as warnings, but not crash my dev server. I...
Read more >
Documentation - The Basics - TypeScript
An editor that supports TypeScript can deliver “quick fixes” to automatically fix errors, refactorings to easily re-organize code, and useful navigation ...
Read more >
Workarounds for Out of Memory Crashes | manual
The first workaround you should try is "noStrictGenericChecks": true . Does compilation now succeed? This disables additional checking that was added in ...
Read more >
Improving TypeScript error handling with exhaustive type ...
Discover an improved method for handling errors in TypeScript that solves problems that arise from returning null and throwing try...catch.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found