TrilonIO / aspnetcore-angular-universal

ASP.NET Core & Angular Universal advanced starter - PWA w/ server-side rendering for SEO, Bootstrap, i18n internationalization, TypeScript, unit testing, WebAPI REST setup, SignalR, Swagger docs, and more! By @TrilonIO
https://www.trilon.io
MIT License
1.46k stars 433 forks source link

ngx-bootstrap aot error #306

Closed borgotecnologia closed 7 years ago

borgotecnologia commented 7 years ago

I've tried to build aot version with that component:

 "@angular/animations": "4.2.2",
    "@angular/common": "4.2.2",
    "@angular/compiler": "4.2.2",
    "@angular/compiler-cli": "4.2.2",
    "@angular/core": "4.2.2",
    "@angular/forms": "4.2.2",
    "@angular/http": "4.2.2",
    "@angular/platform-browser": "4.2.2",
    "@angular/platform-browser-dynamic": "4.2.2",
    "@angular/platform-server": "4.2.2",
    "@angular/router": "4.2.2",
    "@types/node": "8.0.0",
   "ngx-bootstrap": "^1.7.1",

but there are something wrong, I've received that message:

 ERROR in ./Client/ngfactory/~/ngx-bootstrap/modal/modal-backdrop.component.ngfactory.ts
    Module parse failed: S:\EMPREGOS\Core\Universal_Bacon\Angular_File_by_File\Client\ngfactory\node_modules\ngx-bootstrap\modal\modal-backdrop.component.ngfactory.ts Unexpected token (12:35)
    You may need an appropriate loader to handle this file type.
    | import * as i1 from './modal-backdrop.component.ngfactory';
    | import * as i2 from 'ngx-bootstrap/modal/modal-backdrop.component';
    | const styles_ModalBackdropComponent:any[] = ([] as any[]);
    | export const RenderType_ModalBackdropComponent:i0.RendererType2 = i0.ɵcrt({encapsulation:2,
    |     styles:styles_ModalBackdropComponent,data:{}});
     @ ./Client/ngfactory/app/server-app.module.ngfactory.ts 10:0-93
     @ ./Client/main.server.aot.ts

    ERROR in ./Client/ngfactory/~/ngx-bootstrap/Typeahead/typeahead-container.component.ngfactory.ts
    Module parse failed: S:\EMPREGOS\Core\Universal_Bacon\Angular_File_by_File\Client\ngfactory\node_modules\ngx-bootstrap\Typeahead\typeahead-container.component.ngfactory.ts Unexpected token (13
:40)
    You may need an appropriate loader to handle this file type.
    | import * as i2 from 'ngx-bootstrap/Typeahead/typeahead-container.component';
    | import * as i3 from './typeahead-container.component.ngfactory';
    | const styles_TypeaheadContainerComponent:any[] = ([] as any[]);
    | export const RenderType_TypeaheadContainerComponent:i0.RendererType2 = i0.ɵcrt({encapsulation:2,
    |     styles:styles_TypeaheadContainerComponent,data:{}});
     @ ./Client/ngfactory/app/server-app.module.ngfactory.ts 11:0-102
     @ ./Client/main.server.aot.ts

    ERROR in ./Client/ngfactory/~/ngx-bootstrap/typeahead/typeahead-container.component.ngfactory.ts
    Module parse failed: S:\EMPREGOS\Core\Universal_Bacon\Angular_File_by_File\Client\ngfactory\node_modules\ngx-bootstrap\typeahead\typeahead-container.component.ngfactory.ts Unexpected token (13
:40)
    You may need an appropriate loader to handle this file type.
    | import * as i2 from 'ngx-bootstrap/typeahead/typeahead-container.component';
    | import * as i3 from './typeahead-container.component.ngfactory';
    | const styles_TypeaheadContainerComponent:any[] = ([] as any[]);
    | export const RenderType_TypeaheadContainerComponent:i0.RendererType2 = i0.ɵcrt({encapsulation:2,
    |     styles:styles_TypeaheadContainerComponent,data:{}});
     @ ./Client/ngfactory/app/server-app.module.ngfactory.ts 14:0-102
     @ ./Client/main.server.aot.ts

Whats wrong? Do I need to put anything else in webpack?

MarkPieszak commented 7 years ago

Is this from a fresh repo pulldown? I didn't get any errors when running an AoT build. Do you have any code example we can look at? Let me know!

codercodingthecode commented 7 years ago

When running ng build, it doesn't return any errors and it works online. However, when running with ng build --prod I get a bunch of errors and it wont work online. WARNING in ./src/$$_gendir/app/users/login/user.login.component.ngfactory.ts 54:27-32 "export 'ɵa' (imported as 'i5') was not found in 'ngx-intl-tel-input'

WARNING in ./src/$$_gendir/app/users/login/user.login.component.ngfactory.ts 54:34-39 "export 'ɵa' (imported as 'i5') was not found in 'ngx-intl-tel-input'

WARNING in ./src/$$_gendir/app/users/login/user.login.component.ngfactory.ts 54:101-106 "export 'ɵa' (imported as 'i5') was not found in 'ngx-intl-tel-input'

WARNING in ./src/$$_gendir/app/users/signup/user.signup.component.ngfactory.ts 115:27-32 "export 'ɵa' (imported as 'i5') was not found in 'ngx-intl-tel-input'

WARNING in ./src/$$_gendir/app/users/signup/user.signup.component.ngfactory.ts 115:34-39 "export 'ɵa' (imported as 'i5') was not found in 'ngx-intl-tel-input'

WARNING in ./src/$$_gendir/app/users/signup/user.signup.component.ngfactory.ts 115:101-106 "export 'ɵa' (imported as 'i5') was not found in 'ngx-intl-tel-input'

WARNING in ./src/$$_gendir/~/ngx-intl-tel-input/ngx-intl-tel-input.ngfactory.ts 206:201-206 "export 'ɵa' (imported as 'i1') was not found in 'ngx-intl-tel-input'

WARNING in ./src/$$_gendir/~/ngx-intl-tel-input/ngx-intl-tel-input.ngfactory.ts 206:208-213 "export 'ɵa' (imported as 'i1') was not found in 'ngx-intl-tel-input'

WARNING in ./src/$$_gendir/~/ngx-intl-tel-input/ngx-intl-tel-input.ngfactory.ts 206:275-280 "export 'ɵa' (imported as 'i1') was not found in 'ngx-intl-tel-input'

MarkPieszak commented 7 years ago

Can you check ngx-bootstrap issues, this sounds like something on their end that's breaking lately

isaacrlevin commented 7 years ago

I use this repo with the next version of ngx-bootstrap. Try updating your package.json to ^2.0.0-beta.2

ilennert commented 7 years ago

I'm having the same problem using .Net Core 2.0 with all the new template stuff (I'm also using "ngx-bootstrap": "^2.0.0-beta.2") Update (9/7/2017) - Ignore the above. This was confusion on my part. I was not using aspnetcore-angular2-universal... that's why I was having the problem. I am now moving my code to use aspnetcore-angular2-universal

aecuman commented 7 years ago

Has anyone fixed this. I'm having the same problem

isaacrlevin commented 7 years ago

@aecuman are you doing a fresh pull of this repo with the @next version of ngx-bootstrap? What is your error?

aecuman commented 7 years ago

I'm sorry. It looks like a webpack problem after webpack --env.prod though i have not fixed the issue

ilennert commented 7 years ago

Please note: when I reported that I was having this problem with my code. I should not have been reporting it here. I was not at the time using this library (I am moving my code into this example template now...)

jcphlux commented 7 years ago

Has anyone solved this issue and if yes how?

MarkPieszak commented 7 years ago

Do you have a recent version of the repo? I believe all it takes is removing:

include: ClientApp // just remove this part so it takes in node_modules as well during AoT

from the ts rule in webpack.

MarkPieszak commented 7 years ago

@jcphlux

jcphlux commented 7 years ago

@MarkPieszak Thanks. Removing the 'include: ClientApp' did correct the error. Do you know why this was causing this issue?

MarkPieszak commented 7 years ago

Hey @jcphlux, we need to make sure we AoT those files as files as well, by only having include: ClientApp we're ignoring node_modules entirely, which is what caused the issue.

Hope that helps! :)

netbidev commented 7 years ago

Anyone have a solution?