Description
Bug report
What is the current behavior?
I believe this issue has been reported in a closed issue (webpack/webpack#8734)
therefore, report again for visibility:
When the only thing a Typescript file exports is an interface, changes to the interface are not seen by watch
I believe files only contain interfaces contain no real Javascript and that is the issue that webpack is not able to detect any changes while transpilation.
Tried the workaround with comments that didn't fix the issue, the only way I were able to get the type only
file trigger the build is to have a export { a: 'a' }
then import { a } from './typeOnly.ts'
- which is not ideal and not practical.
If the current behavior is a bug, please provide the steps to reproduce.
Create a file that only export interface/types:
props.ts
interface Props {
name: string
}
export default Props
Then create anther file that import props.ts
:
component.ts
import React, { FunctionComponent } from 'react';
import Props from './props';
const MyComponent: FunctionComponent<Props> = ({ name }) => (
<div>{ name }</div>
);
Modify props.ts
, either add/change/delete properties in Props
then apply those changes to component.ts
Webpack not able to detect the changes in props.ts
and the type errors
report error on the UI.
See screenshot attached below for example:
https://github.com/kenilam/Ki.CL is my repos where you can reproduce.
What is the expected behavior?
Webpack watch should be able to pick up file changes that only contain type
values
Other relevant information:
webpack version: 4.43.0
Node.js version: 14.4.0
This issue was moved from webpack/webpack#11121 by @sokra. Original issue was by @kenilam.