You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With TypeScript 2.7 support for the API is being exposed. This wonderful PR by @sheetalkamat to ts-loader added support for the API to ts-loader.
Naturally I'm super-excited about this! We pushed out v3.3.0 of ts-loader including support for the new watch API (which is available in the night builds).
Alas, the watch API functionality doesn't seem to be working as expected. It's unclear whether the problem is with the watch API or with the implementation in ts-loader. I found and fixed a suspected minor issue with the ts-loader watch API support. However everything else looks correct as best I can judge.
There's 2 issues I've spotted:
The new watch API is not detecting file changes
The new watch API does not find the TypeScript APIs (lib.dom.d.ts etc) - if you use lib in your tsconfig.json there are problems.
I'm wondering if this is actually a problem with the watch API itself.
run either yarn start (to use webpack-dev-server) or yarn watch (to use webpack --watch)
See the following in the console:
ERROR in ./src/render.ts
[tsl] ERROR in C:\source\typescript-ts-loader-watch-api-illustration\src\render.ts(2,5)
TS2304: Cannot find name 'i'.
ERROR in ./src/render.ts
[tsl] ERROR in C:\source\typescript-ts-loader-watch-api-illustration\src\render.ts(2,7)
TS2304: Cannot find name 'am'.
ERROR in ./src/render.ts
[tsl] ERROR in C:\source\typescript-ts-loader-watch-api-illustration\src\render.ts(2,10)
TS2304: Cannot find name 'an'.
ERROR in ./src/render.ts
[tsl] ERROR in C:\source\typescript-ts-loader-watch-api-illustration\src\render.ts(2,13)
TS2552: Cannot find name 'error'. Did you mean 'Error'?
webpack: Failed to compile.
comment out line 2 in render.ts (the error) and save the file
note webpack rebuilds but TypeScript continues to report the same errors; it fails to acknowledge the file change.
If you amend the webpack.config.js to set experimentalWatchApi: false and repeat steps 3-6 then you will see that behaviour is as desired. But this is without using the new watch API.
Usage of lib in tsconfig.json does not work
comment out line 2 in render.ts (the error) and save the file
Uncomment the lib section in your tsconfig.json so it looks like this:
Both the issues reported here are resolved - thanks so much! I've released a new version of ts-loader this morning that includes the fixes. I'll keep testing with more complex projects and report back if any other issues occur.
TypeScript Version: 2.7.0-dev.20180120
Search Terms:
watch API
Code
See this illustration repo: https://github.com/johnnyreilly/typescript-ts-loader-watch-api-illustration
Expected behavior:
lib
compiler optionActual behavior:
lib
compiler optionRelated Issues:
Taken from the illustration repo:
New Watch API issues illustration
With TypeScript 2.7 support for the API is being exposed. This wonderful PR by @sheetalkamat to ts-loader added support for the API to ts-loader.
Naturally I'm super-excited about this! We pushed out v3.3.0 of ts-loader including support for the new watch API (which is available in the night builds).
Alas, the watch API functionality doesn't seem to be working as expected. It's unclear whether the problem is with the watch API or with the implementation in ts-loader. I found and fixed a suspected minor issue with the ts-loader watch API support. However everything else looks correct as best I can judge.
There's 2 issues I've spotted:
lib.dom.d.ts
etc) - if you uselib
in yourtsconfig.json
there are problems.I'm wondering if this is actually a problem with the watch API itself.
Here is a simple repro of the issues I've seen.
Not detecting file changes
yarn install
yarn start
(to usewebpack-dev-server
) oryarn watch
(to usewebpack --watch
)render.ts
(the error) and save the fileIf you amend the
webpack.config.js
to setexperimentalWatchApi: false
and repeat steps 3-6 then you will see that behaviour is as desired. But this is without using the new watch API.Usage of
lib
intsconfig.json
does not workrender.ts
(the error) and save the filelib
section in yourtsconfig.json
so it looks like this:yarn watch
The text was updated successfully, but these errors were encountered: