Tagged: Angular Webclipse
- This topic has 1 reply, 2 voices, and was last updated 7 years, 1 month ago by support-swapna.
-
AuthorPosts
-
sbeltParticipantSummary:
App runs in DEV mode, but does not build using ‘ng serve -prod’ saying
ERROR in Can't resolve all parameters for Attendance in C:/development/workspace/myapp/src/app/api/models/attendance.mo del.ts: (?, ?, ?, ?, ?, ?). ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'C:\development\workspace\myapp\src' @ ./src/main.ts 5:0-74 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts webpack: Failed to compile.
Details:
I should start by saying that I do not know if this is a question for Webclipse, or if this is really an Angular 4 question which I should ask on StackOverflow; but, since I am running in Webclipse, I thought I would start here.
I have been developing my first Angular 4 project for a couple months now. So far I have only been running in the default/dev mode. In this mode, all is well. I have no build errors in the ng serve terminal, and the Google DevTools console shows no errors nor warnings. But now I want to build/test in production mode.
Based upon an earlier post, I modified properties of the Servers->Angular CLI->MyApp to add the ‘-prod’ parameter to ng serve. Now, when I attempt to start the server, I get a message about ‘not suitable for production environment’ (telling me my -prod is working), then webpack gets roughly 92% through its process (maybe further – the progress clears before I see any higher value%), then I get the error ‘Can’t resolve all parameters…’ (see full error in Summary above). If I switch back to dev mode (delete the -prod parameter), all builds fine again.
I searched the Net and found many simlar posts, but they all seem to be related to Services – my object is a model. What’s more, those posts seem to indicate the compiler cannot resolve the attribute types, but my attributes are all just ‘string’. Here is the attendance.model.ts:
export class Attendance { constructor( public _id: string, public timestamp_created: string, public timestamp_updated: string, public onDate: string, public classId: string, public studentId: string ) { } }
This model is not referenced in any ngModules. It is imported into one service and one component as:
import { Student, Attendance } from '../../models/index';
And ../../models/index.ts is:
export * from './attendance.model'; export * from './student.model';
My code base has grown large so I cannot put it all in this post, but if there are additional files I should provide, please let me know. In the meanwhile, I would be happy to receive guidance on how to debug this.
Thanks in Advance!
Steve B)
support-swapnaModeratorsbelt,
Sorry that you are seeing this issue. It looks like a development related issue.
Can you please check this link which discusses similar issue and see if the suggestion to fix the environment.prod.ts file helps ? : https://github.com/angular/angular-cli/issues/3348I suggest you also check with Angular development forums or stackoverflow.com for better suggestions from the developer community.
Hope this helps. Please let us know how you get on with it.
–Swapna
MyEclipse Support -
AuthorPosts