Trigger declaration generation in vite build watch mode when non-ts file changes
Description
At the moment, when Vite build watch mode is enabled, declarations get generated only when typescript files are modiefied. I think the declarations should be generated on every change or we should be able to specify which file types trigger the generation.
My use case is that I have a library that has React components and CSS files. When I'm using the watch mode and modify a typescript file, everything works as expected. But when I modify a CSS file, vite triggers a build, which by default empties the out dir first getting rid of the declarations.
Using emptyOutDir would be a way around this, but it has other problems. And even if it worked as its supposed to work, it might have other side effects in different kinds of configurations.
Suggested solution
I'm suggesting that in watch mode, the declarations would get generated on every builld, not just when typescript files changes.
Alternative
Alternatively (or in addition), a config option for file extensions (or globs) that trigger the generation would be a viable solution.
Additional context
No response
Validations
- [X] Read the FAQ.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Would you try to using the include option to include those CSS files and test whether it works?
Including .css files doesn't seem to change anything. This is my config now, it still behaves like described in the issue.
dts({
insertTypesEntry: true,
rollupTypes: true,
exclude: ["**/*.stories.tsx"],
include: ["**/*.ts", "**/*.tsx", "**/*.css"],
}),
Heyho! Any help needed are? If this is a more-or-less good first issue, I'd be happy to hop on. This is somewhat blocking me right now
I still have this problem.