-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"ng serve" gives compilation error #5034
Comments
I have same issue in linux, but this arises when I use "typeRoots" option in tsconfi.app.json with local type definitions file. Randomly fails with the message:
|
Don't use Easiest for you is to create src/typings.d.ts file than in that file to import your custom types: src/typings.d.ts import '../custom_typings/lib1/index';
import '../custom_typings/lib2/index'; |
I figured out the exact issue. The issue is with lazy loading. When I use following route array with PagesModule in imports But works perfectly when I use the following routes array: |
Thanks for the help!. |
@vladotesanovic Is there any reason why you said |
@marcelino-m Thanks. In my testing, the Here is the steps to repro the problem.
When you execute If I run In my Visual Studio Code, no problem at all. Is that an issue? |
@doggy8088 Hi, I think you are missing install jquery. You have just instaled @types/jquery (types definition for jquery) Here what I done:
Edit app.component.ts (import jquery module)
So run
Run Ok. if you wish now you cant install @types/jquery
Cheers! |
@marcelino-m Yes, you are right. It do works using your way to setup jquery. In my case, my jquery has already been loaded in the index.html file. I don't want to load it again and bundled with my Angular app. So there is long time, I use jquery by this way which is load As I mentioned in my original question, my current setup can work as expected in my Visual Studio Code and using tsc standalone. It only show up errors when I using |
Known issue & PR here: #5251 |
Heya, errors like The CLI always runs statical analysis on code to ensure it will run when compiled with AOT. This may cause a lot of static analysis errors to surface when importing your project into the CLI, or upgrading for older versions where we didn't run this kind of analysis. A good resource on how to to debug these errors is https://github.com/rangle/angular-2-aot-sandbox#aot-dos-and-donts. The other issues brought up seem to be completely unrelated to the original one. Please open new issues and fill out the issue template for them. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS: Windows 10
Versions :
@angular/cli: 1.0.0-rc.0
node: 6.10.0
os: win32 x64
Reproduction steps:
It's an app that is fully created with angular-CLI.
The log given by the failure.
`ng serve
** NG Live Development Server is running on http://localhost:4200 **
Hash: 9fbd9d1c055b9f5a4fca
Time: 13195ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 153 kB {5} [initial] [rendered]
chunk {1} styles.bundle.js, styles.bundle.js.map (styles) 198 kB {5} [initial] [rendered]
chunk {2} main.bundle.js, main.bundle.js.map (main) 17.5 kB {4} [initial] [rendered]
chunk {3} scripts.bundle.js, scripts.bundle.js.map (scripts) 434 kB {5} [initial] [rendered]
chunk {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 3.13 MB [initial] [rendered]
chunk {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
ERROR in Error encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'routes'. Consider exporting the symbol (position 5:7 in the original .ts file), resolving symbol AppRoutingModule in D:/TesTracker/src/app/app-routing.module.ts
webpack: Failed to compile.
webpack: Compiling...
Hash: 9fbd9d1c055b9f5a4fca
Time: 2302ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 153 kB {5} [initial]
chunk {1} styles.bundle.js, styles.bundle.js.map (styles) 198 kB {5} [initial]
chunk {2} main.bundle.js, main.bundle.js.map (main) 17.5 kB {4} [initial]
chunk {3} scripts.bundle.js, scripts.bundle.js.map (scripts) 434 kB {5} [initial]
chunk {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 3.13 MB [initial]
chunk {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry]
webpack: Compiled successfully.`
Mention any other details that might be useful.
The issue arises when I create child routes and use loadchildren from the calling router module
Note: I have made no changes when it compiled successfully the second time. I just re-saved a file just to make it recompile and it does the work.
Update
I figured out the exact issue. The issue is with lazy loading. When I use following route array with PagesModule in imports
[{ path: '', children: [ { path: 'pages', loadChildren: () => PagesModule }, { path: '', redirectTo: 'pages', pathMatch: 'full' } ] }]
But works perfectly when I use the following routes array:
[ { path: '', children: [ { path: 'pages', loadChildren: './pages/pages.module#PagesModule' }, { path: '', redirectTo: 'pages', pathMatch: 'full' } ] } ]
The text was updated successfully, but these errors were encountered: