560908 (3) [Avatar] Offline
Console Error
[ 20 KB ]
I sense that this might be a problem with SystemJS loader (or perhaps one of its dependencies), but I haven't been able to resolve the matter.

Copy-pasting the code in directory
for Chapter 3 into my html structure, and running
npm start
results in a blank web-page and the following message in the console:

(SystemJS) expected expression, got '<'

Augury doesn't even recognise the page as being an Angular application.

Has anyone seen this, and have a clue how to fix it? I'm assuming that it'll affect all the code for every chapter after chapter 3, making the code in the book impossible to follow.

When I copy the folder for chapter 2 back into my working directory, the page loads fine.

Running on Windows 7 if that makes any difference :-/

Anton Moiseev (27) [Avatar] Offline
I just tried to checkout the code from this directory: chapter3/auction. Installed dependencies with npm install and launched the app with npm start, everything works fine. You mentioned you copied the code into your HTML structure, likely it causes the problem, but I cannot suggest how to fix it.
560908 (3) [Avatar] Offline
Thanks for your reply - I just saw it now.

The problem was my bad apparently...

systemjs.config.js was missing a package declaration.

        '@angular/router'                  : {main: 'router.umd.min.js'},

I learned a bit about debugging errors in SystemJS while doing this. I basically found that it's pretty hard to debug and figure out what the actual problem is! :-/

The reason that the Chapter 2 code works of course, is that routing isn't used in Chapter 2. The code for setting up systemjs.config.js in the book (page 49) doesn't include the declaration for routing (because routing isn't introduced until Chapter 3). Chapter 3 doesn't specifically mention that you need to update systemjs.config.js. smilie

I agree that the code on the website is correct (I only copied the "app" folder, not the root folder).
Anton Moiseev (27) [Avatar] Offline
The code in the GitHub repo has config for the router package. Debugging SystemJS is hard, it's true. And since Angular moved away from SystemJS, our second edition doesn't cover SystemJS anymore.
560908 (3) [Avatar] Offline
Further to your point here about SystemJS, what alternative do you use? Am I right in thinking that Webpack is the way that the community seems to be gravitating?

Also, when can we expect the next edition of the book to be released?