dojo / cli-build-webpack

🚀 **DEPRECATED** Dojo 2 - cli command for building applications
http://dojo.io
Other
4 stars 19 forks source link

Generate css-module d.ts files as part of build command. #66

Closed tomdye closed 7 years ago

tomdye commented 7 years ago

css-module-typings should be created as part of our webpack build process. Furthermore they should be included in the watch process such that they are generated as they are edited. An attempt was made to use typed-css-module-loader but this was not sufficient. There are outstanding PR's and issues on this loader which may provide a solution but it's likely that we may need to create a typescript pre-loader which plucks out the .css imports and creates the appropriate typings.

tomdye commented 7 years ago

Initial work has been carried out to create a typescript pre-loader that parses the typescript and looks for .css imports before generating the appropriate .d.ts files.

This works correctly for the first run / dojo build usage but does not re-compile when a .css file is edited in watch mode.

I tried using addDependency to make the ts files dependent on the .css.d.ts files they generated and also made the .css files themselves dependent on the .css.d.ts files but this causes a cyclical build issue where it rebuilds indefinitely.

Current code is pushed upto a branch: https://github.com/tomdye/cli-build/tree/dts-preloader

Diff can be seen here: https://github.com/dojo/cli-build/compare/master...tomdye:dts-preloader