microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.21k stars 12.51k forks source link

Computing buildInfoTime even when !isIncremental #60500

Open JasonKleban opened 1 week ago

JasonKleban commented 1 week ago

@sheetalkamat @johnnyreilly I'm out of my depth, but I think there's maybe a bug introduced here.

I'm getting TypeError: Cannot read properties of undefined (reading 'includes') in fork-ts-checker-webpack-plugin when my project is NOT incremental: true.

Prior to this revision buildInfoTime was not computed if buildInfoPath was undefined but after this change, even though buildInfoPath is undefined, it is still attempting to compute ts_getModifiedTime(host, buildInfoPath)

Eventually, this calls to isArtifact(undefined) in fork-ts-checker-webpack-plugin\lib\typescript\worker\lib\system.js

[function isArtifact(path) {

return ((artifacts.dirs.some((dir) => path.includes(dir)) ||

    artifacts.files.some((file) => path === file)) &&

    artifacts.extensions.some((extension) => path.endsWith(extension)));

}](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/0fab463b21c6edc4d94834568a3f440241d57887/src/typescript/worker/lib/system.ts#L284C1-L290C2)

Perhaps this needs to be handled in fork-ts-checker-webpack-plugin? But it seems to me that perhaps buildInfoTime could be skipped when buildInfoPath is unavailable.

Originally posted by @JasonKleban in dca9182