Ionic-app-scripts: Error: No component factory found for e.

Created on 28 Apr 2017  路  16Comments  路  Source: ionic-team/ionic-app-scripts

Release rollup build with 1.3.6.
For 1.3.5 every works correct.

Uncaught (in promise): Error: No component factory found for e. Did you add it to @NgModule.entryComponents?
Error: No component factory found for e. Did you add it to @NgModule.entryComponents?
    at g (http://localhost:8080/assets/app/ionic/build/polyfills.js:3:7133)
    at noComponentFactoryError (http://localhost:8080/assets/app/ionic/build/main.js?v=v3.0.0.beta7:1:14206)
    at e.resolveComponentFactory (http://localhost:8080/assets/app/ionic/build/main.js?v=v3.0.0.beta7:30:2408)
    at e.resolveComponentFactory (http://localhost:8080/assets/app/ionic/build/main.js?v=v3.0.0.beta7:30:2915)
    at e.resolveComponent (http://localhost:8080/assets/app/ionic/build/main.js?v=v3.0.0.beta7:50:4484)
    at t._viewInit (http://localhost:8080/assets/app/ionic/build/main.js?v=v3.0.0.beta7:50:31685)
    at http://localhost:8080/assets/app/ionic/build/main.js?v=v3.0.0.beta7:50:28902
    at t.invoke (http://localhost:8080/assets/app/ionic/build/polyfills.js:3:14529)
    at Object.onInvoke (http://localhost:8080/assets/app/ionic/build/main.js?v=v3.0.0.beta7:30:9763)
    at t.invoke (http://localhost:8080/assets/app/ionic/build/polyfills.js:3:14469)
    at n.run (http://localhost:8080/assets/app/ionic/build/polyfills.js:3:9741)
    at http://localhost:8080/assets/app/ionic/build/polyfills.js:3:6774
    at t.invokeTask (http://localhost:8080/assets/app/ionic/build/polyfills.js:3:15213)
    at Object.onInvokeTask (http://localhost:8080/assets/app/ionic/build/main.js?v=v3.0.0.beta7:30:9663)
    at t.invokeTask (http://localhost:8080/assets/app/ionic/build/polyfills.js:3:15134)
    at n.runTask (http://localhost:8080/assets/app/ionic/build/polyfills.js:3:10390)
    at a (http://localhost:8080/assets/app/ionic/build/polyfills.js:3:5313)

Most helpful comment

Can you all test nightly for me? This should be resolved in 99.9% of the cases (I hope!)

npm install @ionic/app-scripts@nightly

Thanks,
Dan

All 16 comments

got same error with 1.3.6
e.g.:

  • LoadingController
  • own modal-components

semi-fix: without --prod flag the build kinda runs...

Can you run the following and see if you still get an error? Hopefully it gives us more info.

npm run ionic:build --aot --optimizejs

Thanks,
Dan

without --optimizejs the app is running w/o problems on 1.3.6 :) I have run the following npm-scripts:

  • ionic-app-scripts build android --aot (work)
  • ionic-app-scripts build android --aot --minifyCss --minifyJs (work)
  • ionic-app-scripts build android --aot --optimizejs (not working)
Cordova CLI: 6.5.0
Ionic Framework Version: 3.1.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.6
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v6.10.2
Xcode version: Xcode 8.3.2 Build version 8E2002

@EbilPanda, @kleeb ,

Do you have a repo to share that we can use to figure out where the bug is?

Thanks,
Dan

@danbucholtz

I'm personally experiencing this issue when attempting to display a loading dialog from a provider.
Just created a project here to demonstrate the issue: https://github.com/ihadeed/app-scripts-936

@ihadeed,

Thanks! I'll have a fix out soon. In the meantime, you can disable ionic_manual_treeshaking by setting it to false in the package.json config section.

Thanks,
Dan

thanks, thats working!

running

ionic-app-scripts build android --prod
ionic-app-scripts build ios --prod

with

"config": { "ionic_manual_treeshaking": false, }

works :)

whats the treeshaking for? because of lazyloading? :)
(or the lack of it...?)

Manual tree shaking is a method we devised to remove unused code. Webpack and uglify do not do a very good job of it.

@ihadeed, I am running your repo right now. I'll ping you if I have any questions.

Thanks,
Dan

Can you all test nightly for me? This should be resolved in 99.9% of the cases (I hope!)

npm install @ionic/app-scripts@nightly

Thanks,
Dan

Thanks @danbucholtz !

The app builds and works well now with --prod flag.

I had a similar problem with a modal in a module. I could see in the debug logs that tree shaking purged the modal-controller.js.

But with the nightly build, everything is fine. Thanks a lot!

This should be fixed in 1.3.7.

Thanks,
Dan

Works for me as well in 1.3.7.
Thanks again Dan!

In login page 馃憤 :

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { LoginPage } from './login';
import { SignupPage } from '../signup/signup'; <-----------------add the component here

@NgModule({
declarations: [
LoginPage,
SignupPage <---------------------------------------add the component here
],
imports: [
IonicPageModule.forChild(LoginPage),
],
entryComponents: [
SignupPage <---------------------------------------add the component here
],
})
export class LoginPageModule {}

馃挴 solved.

Hi team,

kindly find below the error I can't fixe

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'ionic:build',
1 verbose cli '--aot' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: ionic:build
4 verbose stack at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:155:19)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:63:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:115:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:418:5
4 verbose stack at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:373:45)
4 verbose stack at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:416:3)
4 verbose stack at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:160:5)
4 verbose stack at ReadFileContext. (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:332:20)
4 verbose stack at ReadFileContext.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16)
4 verbose stack at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:420:13)
5 verbose cwd C:\Users\ARTEFAX-MEYSONE\RegisterApp
6 verbose Windows_NT 10.0.17134
7 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "ionic:build" "--aot"
8 verbose node v8.12.0
9 verbose npm v6.4.1
10 error missing script: ionic:build
11 verbose exit [ 1, true ]

@jaganchoccy

Many thanks,it's working as well

Was this page helpful?
0 / 5 - 0 ratings