-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
Webpack watch missing changed files #697
Comments
Thanks for the minimal repro repo - that's always appreciated. I suspect the issue is that the file in question is interfaces only; i.e. it produces no JS output which means file changes result in no changes to the JS output. As far as webpack is concerned, there wasn't any output before; there isn't now either. There's not an immediately obvious solution to this. However, I'm hopeful that when the new watch API changes get merged (#685) this may resolve the issue. |
Right now there is at least the defintion file updated. Wouldn't it this idea be possible:
|
As well, right now it does not even help to touch those files and there is no hook into the loader to trigger it manually (I know what was updated and when). |
To give some more info here, this is the content of the times object in {
'/x/webpack-test/src/sub/app.tsx': 1513681246518,
'/x/webpack-test/src/sub/index.tsx': 1513691257828,
'/x/webpack-test/src/sub/package.json': 1513679868805,
'/x/webpack-test/src/sub/tsconfig.json': 1513679868805,
'/x/webpack-test/dist/core/index.d.ts': 1,
'/x/webpack-test/dist/core/plugin.d.ts': 1,
'/x/webpack-test/node_modules/@types/node/index.d.ts': 1,
'/x/webpack-test/node_modules/@types/node/inspector.d.ts': 1,
'/x/webpack-test/node_modules/@types/react-dom/index.d.ts': 1,
'/x/webpack-test/node_modules/@types/react/global.d.ts': 1,
'/x/webpack-test/node_modules/@types/react/index.d.ts': 1,
'/x/webpack-test/node_modules/typescript/lib/lib.d.ts': 1
} Everything with a timestamp of 1 and not 'living' in |
I'm open to PRs that fix the issue - I'd be happy to advise along the way |
If a project depends on custom definition files, meaning not the ones in node_modules, then it should consider them changed when webpack triggers a watch-run. Since webpack doesn't know about definition files, we use the one detected by the languageService which should be more accurate anyway. Closes TypeStrong#697
I have encountered the same problem. The reason for this problem is not just a pure types file, but a ts file that is not actually used. That is, only This problem can be solved by Don't worry. The webpack production mode can removes empty modules and tree shaking. This won't have extra code being packaged. 😄 my casetype.ts export interface InterfaceA {
a1: number;
a2: string;
}
export function test() {
console.log('test');
} index.ts import { InterfaceA } from './type';
// import './type';
export function app(value: InterfaceA) {
console.log(value.a1.toFixed(0));
console.log(value.a2.trim());
} |
Expected Behaviour
Detect all changed files used in a compilation
Actual Behaviour
Some files are missing in some cases
Steps to Reproduce the Problem
https://github.com/KnisterPeter/webpack-multi-app-test
Run
npm run watch
and changesrc/core/plugin.ts
.It is expected that
src/sub/index.tsx
fails afterswards.Location of a Minimal Repository that Demonstrates the Issue.
https://github.com/KnisterPeter/webpack-multi-app-test
The problem is within the
watch-run
. Changed files are filtered here. Maybe its deeper and webpack does not set correct timestamps.https://github.com/TypeStrong/ts-loader/blob/master/src/watch-run.ts#L25
The text was updated successfully, but these errors were encountered: