日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Debug a Server–Side Rendered SAP Spartacus Storefront Using Chrome Dev Tools

發布時間:2023/12/19 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Debug a Server–Side Rendered SAP Spartacus Storefront Using Chrome Dev Tools 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

In SAP Spartacus document there is a page for “How to Debug a Server–Side Rendered Storefront” using Visual Studio Code.

https://sap.github.io/spartacus-docs/3.x/how-to-debug-server-side-rendered-storefront/

This document just introduces another way to debug, using Chrome Dev Tools instead of Visual Studio Code.The steps are written based on Spartacus library with version 3.4.1.

(1) create a Storefront using Spartacus library and enable it with SSR support using Schematics,by following this document:

https://sap.github.io/spartacus-docs/3.x/building-the-spartacus-storefront-from-libraries-3-4/

(2) By default a script build:ssr is generated to build Storefront and launch it in SSR mode.

The build option --prod and production configuration is used so it means in this way you have to debug a version with minified and uglified code.

So we can create another script build:ssrdev with --prod and production configuration removed, so it comes with this content:

ng build && ng run mystore:server

In this way, check the bundles generated in folder server,we have un-minified source code which is easier for debugging now.

(3) add --inspect-brk option in node command in package.json file:

cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node --inspect-brk dist/mystore/server/main.js

npm run serve:ssr

(4) open chrome://inspect,press “inspect” hyperlink:

Then Chrome dev tools opens, with breakpoint stopped at the first line of main.js bundle, thanks to the --inspect-brk option:

Now we can debug at will. Press Ctrl + O and type the name of the file in which we would like to debug:

For example,if I would like to debug HTML tag generation process for SEO purpose, I can set breakpoint in file spartacus-storefront.js, class SeoMetaService.We can now just debug the Storefront running in SSR mode, just like the same when it is rendered using CSR ( Client Side Render ) mode.

Happy debugging!

更多Jerry的原創文章,盡在:“汪子熙”:

總結

以上是生活随笔為你收集整理的Debug a Server–Side Rendered SAP Spartacus Storefront Using Chrome Dev Tools的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。