简体   繁体   中英

Angular 2 Webpack demo not working

I have completed steps for official tutorial and I got error:

Failed to load app.component.html ; Zone: <root> ; Task: Promise.then ; Value: Failed to load app.component.html undefined

My Github Repo

I have spotted another web page on web with same problem: Example

Could problem be in Angular itself?

I traced the issue by starting to "debug" angular2-template-loader with console log adding: console.log("+++++++"+source); just after the function definition. By doing it I saw that not all the ts file were processed and in particular app.component.ts.

Then I saw in the src folder .js and .map files, so I deleted it and added in the tsconfig.json those properties after compilerOptions (outside it): "compileOnSave": false, "buildOnSave": false

Run again npm start and now the application loads successfully.

@TeodorKolev: I cloned your repo, npm install and npm start and replicated the error. I deleted the .js and .map files created, then added the properties and then npm start again and now it's working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM