问题一, 当运行server sider rendering 时, 报错ReferenceError: _hmt is not defined
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Build at: 2023-11-16T08:00:28.460Z - Hash: b945708904bd624f - Time: 78602ms ⠙ Prerendering 13 route(s) to D:\dev\proj\demo-angular-project\dist\demo-angular-web\browser...ReferenceError: _hmt is not defined at new Angulartics2BaiduAnalytics (D:\dev\proj\demo-angular-project\dist\demo-angular-web\server\main.js:199481:12) at Object.Angulartics2BaiduAnalytics_Factory [as factory] (D:\dev\proj\demo-angular-project\dist\demo-angular-web\server\main.js:199536:10) at D:\dev\proj\demo-angular-project\dist\demo-angular-web\server\main.js:134269:33 at runInInjectorProfilerContext (D:\dev\proj\demo-angular-project\dist\demo-angular-web\server\main.js:125777:5) at R3Injector.hydrate (D:\dev\proj\demo-angular-project\dist\demo-angular-web\server\main.js:134268:9) at R3Injector.get (D:\dev\proj\demo-angular-project\dist\demo-angular-web\server\main.js:134148:23) at R3Injector.get (D:\dev\proj\demo-angular-project\dist\demo-angular-web\server\main.js:134157:27) at ChainedInjector.get (D:\dev\proj\demo-angular-project\dist\demo-angular-web\server\main.js:138783:32) at lookupTokenUsingModuleInjector (D:\dev\proj\demo-angular-project\dist\demo-angular-web\server\main.js:129505:31) at getOrCreateInjectable (D:\dev\proj\demo-angular-project\dist\demo-angular-web\server\main.js:129551:10) ✖ Prerendering routes to D:\dev\proj\demo-angular-project\dist\demo-angular-web\browser failed. _hmt is not defined
问题原因: 因为时server side 而不是浏览器中运行angulartics2, 所以找不到_hmt