I am maintaining an Angular library that makes generous use of the async
and await
keywords. Debugging the resulting JavaScript code is troublesome when targeting ES5
due to all the polyfill action going on. Even with source maps present, the TypeScript debugger often becomes lost and starts stepping through the polyfill maze that is the generated JavaScript code.
For local development on this library, I can change the target
specified in tsconfig.json
to ES2017
, so that async
and await
are not replaced with polyfills while generating the JavaScript code, allow the debugger to step through the code without any issues. After making changes, the library is then packaged using ng-packagr
and integrated into another application.
Sometimes, the library encounters problems when used in conjunction with this application that are not easily reproduced in the library's development environment. I would like to debug such problems in the same fashion, i.e. by changing the target
to ES2017
before packaging, allowing me to easily step through code using async / await
. However, it appears that ng-packagr
ignores this, and still replaces the async
and await
keywords with polyfills. Am I doing something wrong? Should I provide the desired target
to ng-packagr
in a different fashion?