Skip to content

Exception when tslint-loader reports error #19

@dfederm

Description

@dfederm

When using tslint-loader and webpack is in watch mode, there's an exception when the tslint-loader reports an error, which crashes the process and stops the watch.

Exception:

 40% building modules 1/2 modules 1 active ...ientSuggestions\ancientSuggestions.tsC:\Users\David\Code\ClickerHeroesTracker\WebClient\node_modules\thread-loader\dist\WorkerError.js:14
  var originError = err.stack.split('\n').filter(function (line) {
                             ^

TypeError: Cannot read property 'split' of undefined
    at stack (C:\Users\David\Code\ClickerHeroesTracker\WebClient\node_modules\thread-loader\dist\WorkerError.js:14:30)
    at new WorkerError (C:\Users\David\Code\ClickerHeroesTracker\WebClient\node_modules\thread-loader\dist\WorkerError.js:44:19)
    at PoolWorker.fromErrorObj (C:\Users\David\Code\ClickerHeroesTracker\WebClient\node_modules\thread-loader\dist\WorkerPool.js:251:14)
    at PoolWorker.onWorkerMessage (C:\Users\David\Code\ClickerHeroesTracker\WebClient\node_modules\thread-loader\dist\WorkerPool.js:230:37)
    at C:\Users\David\Code\ClickerHeroesTracker\WebClient\node_modules\thread-loader\dist\WorkerPool.js:122:17
    at Socket.onChunk (C:\Users\David\Code\ClickerHeroesTracker\WebClient\node_modules\thread-loader\dist\readBuffer.js:32:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Socket.Readable.read (_stream_readable.js:381:10)
    at flow (_stream_readable.js:761:34)
    at resume_ (_stream_readable.js:743:3)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! clicker-heroes-tracker-webclient@0.0.0 watch: `webpack --config ./webpack.config.js --progress --profile --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the clicker-heroes-tracker-webclient@0.0.0 watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Relevant package versions:

    "thread-loader": "^1.1.4",
    "tslint-loader": "^3.5.3",
    "webpack": "^3.11.0",

Subset of webpack.config.js

    config.module.rules = [
      {
        test: /\.ts$/,
        enforce: 'pre',
        loader: 'tslint-loader',
        exclude: path.resolve("./node_modules"),
        options: {
          configFile: path.resolve('./tslint.json'),
          tsConfigFile: path.resolve('./tsconfig.json'),
          emitErrors: true,
          failOnHint: true,
          typeCheck: true,
          fix: true,
        }
      },

// ...

    config.module.rules.push({
      test: /\.ts$/,
      loaders: [
        'cache-loader',
        {
          loader: 'thread-loader',
          options: {
            // there should be 1 cpu for the fork-ts-checker-webpack-plugin
            workers: require('os').cpus().length - 1
          }
        },
        {
          loader: 'ts-loader',
          options: {
            // IMPORTANT! use happyPackMode mode to speed-up compilation and reduce errors reported to webpack
            happyPackMode: true,
          }
        },
        'angular2-template-loader'
      ]
    });


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions