The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Lorin S (45) [Avatar] Offline
#1
Straight cut and paste from Listing 2.14 into the app.routes.ts file results in the following error (in Chrome) when the page is loaded:

main.bundle.js:15Uncaught Error: Module build failed: Error: /Users/lorin/Projects/workspace/Dublin_Angular2/stocks/src/app/app.routes.ts (16,14): Exported variable 'AppRoutes' has or is using name 'ModuleWithProviders' from external module "/Users/lorin/Projects/workspace/Dublin_Angular2/stocks/node_modules/@angular/core/src/metadata/ng_module" but cannot be named.)
    at _checkDiagnostics (/Users/lorin/Projects/workspace/Dublin_Angular2/stocks/node_modules/@ngtools/webpack/src/loader.js:115:15)
    at /Users/lorin/Projects/workspace/Dublin_Angular2/stocks/node_modules/@ngtools/webpack/src/loader.js:140:17
    at _checkDiagnostics (/Users/lorin/Projects/workspace/Dublin_Angular2/stocks/node_modules/@ngtools/webpack/src/loader.js:115:15)
    at /Users/lorin/Projects/workspace/Dublin_Angular2/stocks/node_modules/@ngtools/webpack/src/loader.js:140:17
    at Object.1012 (http://localhost:4200/main.bundle.js:15:7)
    at __webpack_require__ (http://localhost:4200/inline.bundle.js:53:30)
    at Object.522 (http://localhost:4200/main.bundle.js:173:70)
    at __webpack_require__ (http://localhost:4200/inline.bundle.js:53:30)
    at Object.526 (http://localhost:4200/main.bundle.js:366:70)
    at __webpack_require__ (http://localhost:4200/inline.bundle.js:53:30)
    at Object.423 (http://localhost:4200/main.bundle.js:150:64)
    at __webpack_require__ (http://localhost:4200/inline.bundle.js:53:30)
    at Object.1010 (http://localhost:4200/main.bundle.js:7:18)
    at __webpack_require__ (http://localhost:4200/inline.bundle.js:53:30)
1012 @ main.bundle.js:15
__webpack_require__ @ bootstrap 1702c17…:52
522 @ main.ts:12
__webpack_require__ @ bootstrap 1702c17…:52
526 @ summary.component.ts:19
__webpack_require__ @ bootstrap 1702c17…:52
423 @ src async:7
__webpack_require__ @ bootstrap 1702c17…:52
1010 @ main.bundle.js:7
__webpack_require__ @ bootstrap 1702c17…:52
webpackJsonpCallback @ bootstrap 1702c17…:23
(anonymous) @ main.bundle.js:1
client?93b6:38[WDS] Errors while compiling.
client?93b6:80./src/app/app.routes.ts
Module build failed: Error: /Users/lorin/Projects/workspace/Dublin_Angular2/stocks/src/app/app.routes.ts (16,14): Exported variable 'AppRoutes' has or is using name 'ModuleWithProviders' from external module "/Users/lorin/Projects/workspace/Dublin_Angular2/stocks/node_modules/@angular/core/src/metadata/ng_module" but cannot be named.)
    at _checkDiagnostics (/Users/lorin/Projects/workspace/Dublin_Angular2/stocks/node_modules/@ngtools/webpack/src/loader.js:115:15)
    at /Users/lorin/Projects/workspace/Dublin_Angular2/stocks/node_modules/@ngtools/webpack/src/loader.js:140:17
 @ ./src/app/app.module.ts 15:0-41
 @ ./src/app/index.ts
 @ ./src/main.ts
 @ multi main




The apparent fix (found here: http://stackoverflow.com/questions/39081893/routing-exported-variable-foo-has-or-is-using-name-modulewithproviders-from) was to add the following import:

import { ModuleWithProviders } from '@angular/core';
jeremy.wilken (208) [Avatar] Offline
#2
I cannot reproduce this, are you using the 1.0.0-beta.19-3 version of the CLI?
Lorin S (45) [Avatar] Offline
#3

angular-cli: 1.0.0-beta.22-1
node: 7.0.0
os: darwin x64
jeremy.wilken (208) [Avatar] Offline
#4
Can you please downgrade to 1.0.0-beta19.3? The CLI has breaking changes.