-
-
Notifications
You must be signed in to change notification settings - Fork 434
Description
Given
bar.ts:
export const enum BarEnum {
Bar = 1
};
foo.ts:
export { BarEnum } from './bar';
app.ts:
import { BarEnum } from './foo';
console.log(BarEnum.Bar);
the emit for app.ts in the initial build looks like the following:
"use strict";
console.log(1 /* Bar */);
After changing bar.ts to
export const enum BarEnum {
Bar = 2
};
no modules will be rebuild. The expected output after the change would be
"use strict";
console.log(2 /* Bar */);
This is because ts-loader currently only adds the direct dependencies of modules as dependencies to webpack. Because bar.ts is not a direct dependency of app.ts, app.ts will not be rebuild when bar.ts changes.
For semantic errors the deeper dependencies are handled in the after-compile hook, but this doesn't help in cases like const enums where the actual emit can depend on deeper dependencies.
I believe awesome-typescript-loader does add all actual dependencies of a module as webpack dependencies recursively, which I think is the only way to handle these (relatively rare) cases correctly.
I'll post a pull-request with a test showcasing this error.