unused-files-webpack-plugin icon indicating copy to clipboard operation
unused-files-webpack-plugin copied to clipboard

Support Flow type imports

Open elliotdavies opened this issue 7 years ago • 3 comments

Hello,

I was wondering what it would take to support the import type { MyType } from './myFile' syntax used by Flow. I have a couple of files that show up as warnings because they're only used for type rather than value exports.

If you could point me in the right direction then I'd be happy to attempt a PR.

Many thanks!

elliotdavies avatar Jan 26 '18 00:01 elliotdavies

That'd be awesome, but this plugin relies on webpack to parse the dependencies of a file. Unless webpack supports FlowType natively, we won't be able to parse the files without introducing 3rd parser like babylon.

tomchentw avatar Jan 26 '18 02:01 tomchentw

Ah... So Webpack never actually sees the Flow-only files, because they're only parsed by Flow itself (and then in my case the annotations are removed by Babel)? That's annoying.

elliotdavies avatar Feb 14 '18 12:02 elliotdavies

How about ts? In my mind ts is handled by ts-loader. so can this loader handle after ts-loader and analyse the interface.ts

xiayuxiaoyan avatar May 31 '19 08:05 xiayuxiaoyan