Fork-ts-checker-webpack-plugin: New files or overwritten files problems

Created on 7 Jun 2018  路  8Comments  路  Source: TypeStrong/fork-ts-checker-webpack-plugin

I'm receiving the following error when I add new files, refer them, delete or overwrite files, e.g on git branch switch, and it requires me to fully restart the webpack process:

Compiling...
packages\react-app-rewired\node_modules\fork-ts-checker-webpack-plugin\lib\service.js:22
        throw error;
        ^

FatalError:
Invalid source file: apps\website\src\services\track.ts. Ensure that the files supplied to lint have a .ts, .tsx, .d.ts, .js or .jsx extension.

    at new FatalError (packages\react-app-rewired\node_modules\tslint\lib\error.js:27:28)
    at Linter.getSourceFile (packages\react-app-rewired\node_modules\tslint\lib\linter.js:222:23)
    at Linter.lint (packages\react-app-rewired\node_modules\tslint\lib\linter.js:96:31)
    at packages\react-app-rewired\node_modules\fork-ts-checker-webpack-plugin\lib\IncrementalChecker.js:150:30
    at WorkSet.forEach (packages\react-app-rewired\node_modules\fork-ts-checker-webpack-plugin\lib\WorkSet.js:17:13)
    at IncrementalChecker.getLints (packages\react-app-rewired\node_modules\fork-ts-checker-webpack-plugin\lib\IncrementalChecker.js:147:17)
    at run (packages\react-app-rewired\node_modules\fork-ts-checker-webpack-plugin\lib\service.js:15:29)
    at process.<anonymous> (packages\react-app-rewired\node_modules\fork-ts-checker-webpack-plugin\lib\service.js:38:5)
    at process.emit (events.js:180:13)
    at emit (internal/child_process.js:783:12)

How can this be prevented? Or at least ignored, so that it can recover?

All 8 comments

hello, got the same problem ... any updates ?

Same problem here.
And the watcher doesn't recover afterwards, so I have to kill and restart it, which is pretty annoying

If you'd like to submit a PR to address this we'll take a look.

Same issue in our project. Moreover, the checker service crashes from time to tome even when I'm working on unit test files, which are excluded in tsconfig:

/app/node_modules/fork-ts-checker-webpack-plugin/lib/service.js:22
throw error;
^
FatalError:
Invalid source file: /app/src/components/SlateEditor/tests/simulator/plugins/shortcut/list/simple one level/toggle list.tsx. Ensure that the files supplied to lint have a .ts, .tsx, .d.ts, .js or .jsx extension.

{
  "compilerOptions": {
    "baseUrl": ".",
    "outDir": "./dist/",
    "module": "esnext",
    "target": "es5",
    "moduleResolution": "node",
    "jsx": "react",
    "lib": ["dom", "es6"],
    "sourceMap": true,
    "forceConsistentCasingInFileNames": true,
    "suppressImplicitAnyIndexErrors": true,
    "strictNullChecks": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": false,
    "noUnusedLocals": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "typeRoots": [
      "node_modules/@types",
      "types"
    ]
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules/**/*",
    "src/components/SlateEditor/tests/**/*",
  ]
}

It's really annoying, have to restart webpack...

For me this type of crash happens regulary even though I just edit normal source files (under /src).
No file adding or removing, just plain text editing.

screen shot 2561-10-10 at 11 20 16
So annoying... :(

I've been having the same issue, every time I add a new tsx file and reference it somewhere.
It's very annoying and slow to restart it every time.

Does anyone have a better workaround for this?

Looks like this issue is fixed as from v0.4.5 thanks to commit https://github.com/Realytics/fork-ts-checker-webpack-plugin/commit/1137f4b7039d52d3e732e2c91b47078db9d29454
Personally, I'm using it through create-react-app-typescript which relies on v0.2.8. As this project is archived in favor of regular create-react-app, I'm stuck and will have to migrate to CRA to get this working.

Was this page helpful?
0 / 5 - 0 ratings