current position:Home>How to find the JavaScript location generated after compiling a component typescript in SAP Spartacus

How to find the JavaScript location generated after compiling a component typescript in SAP Spartacus

2021-08-27 04:28:40 JerryWang_ Wang Zixi

demand

How to find the exact code location that triggers the network request ?

from initiator View the call stack context in , There is no clue .

Find the name of the control that triggered the network request selector:cx-register

stay Storefront TypeScript I can't find it in the source code :

Generated in compilation JavaScript Search inside cx-register: Found three places

Only direct view SAP Spartacus Source code :cx-register Corresponding RegisterComponent, It's defined in user-profile-components.module.ts in :

Finally found RegisterComponent Other dependencies in :

such as :

  • userRegister:UserRegisterFacade
  • globalMessageService:GlobalMessageService
  • fb:FormBuilder
  • router:RoutingService

These dependencies , In the compilation of for In the runtime code , Can see :

These dependencies are used as another module Be inducted into .

I can't see these module In the way of JavaScript Code ?

Search directly RegisterComponent, There are too many results 200 Multiple matches .

Try another way :

eureka :

So the conclusion is ,TypeScript Compiled into JavaScript Source code , Running at Chrome You can still find it in developer tools .

more Jerry The original article of , All in :" Wang Zixi ":

copyright notice
author[JerryWang_ Wang Zixi],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2021/08/20210827042838046n.html

Random recommended