I have an Angular V7 project wrapped in .Net Core 2.2.4 using the latest template, where you can run ng build, ng serve and it works perfect. But when I run it in debug within a Docker for Windows container the index.html is outputted to the browser and "<" char fires an mime error in which I get.
I thought is was an issue with SPA services, or my startup, program but this error message says I have an issue with a Angular module. I was getting circular errors using ng build and thought I fixed them correctly by testing with ng serve. I'm only a year into Angular and .Net Core and I really have no idea where I went wrong.
What I've tried: Building my startup.cs, program.cs, Dockerfile line by line. Examining my Angular files in detail.
This is what Chrome says:
Uncaught SyntaxError: Unexpected token <
core.js:15724 ERROR Error: Uncaught (in promise): Error: Loading chunk home-home-module failed.
(missing: https://localhost:44397/home-home-module.js)
Error: Loading chunk home-home-module failed.
(missing: https://localhost:44397/home-home-module.js)
at HTMLScriptElement.onScriptComplete (bootstrap:133)
at HTMLScriptElement.wrapFn (zone.js:1188)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:17290)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:496)
at invokeTask (zone.js:1540)
at HTMLScriptElement.globalZoneAwareCallback (zone.js:1566)
at resolvePromise (zone.js:814)
at resolvePromise (zone.js:771)
at zone.js:873
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:17290)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at drainMicroTaskQueue (zone.js:595)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:500)
at invokeTask (zone.js:1540)
ng server output sya when I build it in a Docker container for Windows - Linux - partial to keep it short:
chunk {default~admin-admin-module~error-error-module~home-home-module~portfolios-portfolios-module~reviews-~dd04c28b} default~admin-admin-module~error-error-module~home-home-module~portfolios-portfolios-module~reviews-~dd04c28b.js, default~admin-admin-module~error-error-module~home-home-module~portfolios-portfolios-module~reviews-~dd04c28b.js.map (default~admin-admin-module~error-error-module~home-home-module~portfolios-portfolios-module~reviews-~dd04c28b) 339 kB [rendered]
[rendered]
chunk {error-error-module} error-error-module.js, error-error-module.js.map (error-error-module) 9.76 kB [rendered]
chunk {home-home-module} home-home-module.js, home-home-module.js.map (home-home-module) 282 kB [rendered]
chunk {main} main.js, main.js.map (main) 1.04 MB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 220 kB [initial] [rendered]
i 「wdm」: Compiled successfully.
This is what output says, I suspect the answer lies here in SPA and how it builds my project. To me everything looks good here.
chunk {home-home-module} home-home-module.js, home-home-module.js.map (home-home-module) 282 kB [rendered] >[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET https://localhost:44397/runtime.js Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET https://localhost:44397/runtime.js [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[34] Connection id "0HLM9Q6D5OLVD", Request id "0HLM9Q6D5OLVD:00000002": the application aborted the connection. Microsoft.AspNetCore.Server.Kestrel:Information: Connection id "0HLM9Q6D5OLVD", Request id "0HLM9Q6D5OLVD:00000002": the application aborted the connection. [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2] Sending file. Request path: '/runtime.js'. Physical path: '/app/ClientApp/dist/runtime.js' Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware:Information: Sending file. Request path: '/runtime.js'. Physical path: '/app/ClientApp/dist/runtime.js' [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 42.1488ms 0 application/javascript Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 42.1488ms 0 application/javascript [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET https://localhost:44397/home-home-module.js Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET https://localhost:44397/home-home-module.js [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 36.5316ms 200 text/html; charset=UTF-8 Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 36.5316ms 200 text/html; charset=UTF-8
I'm stumped here.