Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Ionic 3: Page module mapping not compiling correctly #848

Closed
Manduro opened this issue Mar 27, 2017 · 62 comments
Closed

Ionic 3: Page module mapping not compiling correctly #848

Manduro opened this issue Mar 27, 2017 · 62 comments

Comments

@Manduro
Copy link
Contributor

Manduro commented Mar 27, 2017

Short description of the problem:

Using the latest Ionic 3 beta, an error occurs when loading the root page. It seems to be caused by how app-scripts creates the page module mapping, so I'm posting it here.

What behavior are you expecting?

It should load. My page modules are just like the lazy-load branch of the conference-app and I'm using the @IonicPage() decorator on my pages.

Let me know if you need more debug info!

Steps to reproduce:

  1. Use <ion-nav root="AccountLoginPage"></ion-nav>
  2. The ids.slice(1).map(...) below errors as ids.length === 1 for all pages
var map = {
	"../pages/account-activate/account-activate.module": [
		99
	],

	(...)

	"../pages/tour/tour.module": [
		127
	]
};
function webpackAsyncContext(req) {
	var ids = map[req];	if(!ids)
		return Promise.reject(new Error("Cannot find module '" + req + "'."));
	return Promise.all(ids.slice(1).map(__webpack_require__.e)).then(function() {
		return __webpack_require__(ids[0]);
	});
};
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
	return Object.keys(map);
};
module.exports = webpackAsyncContext;
webpackAsyncContext.id = 95;



//////////////////
// WEBPACK FOOTER
// ./src async
// module id = 95
// module chunks = 0

Which @ionic/app-scripts version are you using?
1.2.2

Other information:

ERROR TypeError: undefined is not a function
    at Array.map (native)
    at webpackAsyncContext (http://localhost:8100/build/main.js:56228:34)
    at loadAndCompile (http://localhost:8100/build/main.js:93852:35)
    at NgModuleLoader.load (http://localhost:8100/build/main.js:93817:83)
    at ModuleLoader.load (http://localhost:8100/build/main.js:69245:44)
    at DeepLinker.getNavLinkComponent (http://localhost:8100/build/main.js:38001:39)
    at DeepLinker.getComponentFromName (http://localhost:8100/build/main.js:37984:25)
    at getComponent (http://localhost:8100/build/main.js:45278:23)
    at convertToView (http://localhost:8100/build/main.js:45296:16)
    at Nav.setRoot (http://localhost:8100/build/main.js:54640:103)
    at SafeSubscriber._next (http://localhost:8100/build/main.js:125073:43)
    at SafeSubscriber.__tryOrSetError (http://localhost:8100/build/main.js:30319:16)
    at SafeSubscriber.next (http://localhost:8100/build/main.js:30261:27)
    at Subscriber._next (http://localhost:8100/build/main.js:30201:26)
    at Subscriber.next (http://localhost:8100/build/main.js:30165:18)
Cordova CLI: 6.5.0 
Ionic Framework Version: 3.0.0-beta.3
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.2
ios-deploy version: 1.9.1 
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.2.1 Build version 8C1002
@danbucholtz
Copy link
Contributor

@Manduro,

Can you give me access to the repo so I can see what's going on? I can add some unit tests to account for whatever case we're missing.

Thanks,
Dan

@Manduro
Copy link
Contributor Author

Manduro commented Mar 28, 2017

Here is my deeplinkconfig log as requested here.

{
    "links": [
        {
            "loadChildren": "../pages/account-activate/account-activate.module#AccountActivatePageModule",
            "name": "AccountActivatePage",
            "segment": null,
            "priority": "low",
            "defaultHistory": []
        },
       (...)
        {
            "loadChildren": "../pages/tour/tour.module#TourPageModule",
            "name": "TourPage",
            "segment": null,
            "priority": "low",
            "defaultHistory": []
        }
    ]
}

@Manduro
Copy link
Contributor Author

Manduro commented Mar 28, 2017

[Nope](https://github.com/Manduro/ionic-test/issues/1).

@rapropos
Copy link

rapropos commented Mar 28, 2017

I have a theory that this is being caused by the automated @IonicPage generator failing to create an entryComponents stanza.

UPDATE: no, that doesn't seem to be the case. The difference between my app and the ionic-conference app is that __webpack_require__.e (which appears to be "require.ensure") is not defined in my app, but it is in the conference app.

I also note that the conference app has a bunch of [n].main.js files in www/build that appear to be code splitting artifacts, whereas my app does not have any of these.

@Sh1d0w
Copy link

Sh1d0w commented Mar 29, 2017

Same issue here. After updating to the latest ionic 3, routing no more works because of

ERROR
TypeError: Array.prototype.map callback must be a function
map
webpackAsyncContext — src async:114
loadAndCompile — ng-module-loader.js:54
load — module-loader.js:32
getNavLinkComponent — deep-linker.js:168
getComponent — nav-util.js:14
push — nav-controller-base.js:81
previewTimesheet — month-review.ts:469
(anonymous function)
callWithDebugContext — core.es5.js:13060
(anonymous function) — platform-browser.es5.js:2674
onInvokeTask — core.es5.js:4136
runTask — polyfills.js:3:10401
invoke — polyfills.js:3:16178

Looking into the stack trace seems __webpack_require__.e is not defined.

 Your system information:

    Cordova CLI: 6.4.0 
    Ionic Framework Version: 3.0.0-beta.3
    Ionic CLI Version: 3.0.0-beta.5
    ios-deploy version: 1.9.0 
    ios-sim version: 5.0.13 
    OS: macOS Sierra
    Node Version: v7.7.3
    Xcode version: Xcode 8.3 Build version 8E162

@Sh1d0w
Copy link

Sh1d0w commented Mar 29, 2017

PS. I have observed that my project generates single main.js file, while the conference app have multiple split chunks of main.js, maybe that's something to do with it as well.

@darthdie
Copy link

darthdie commented Mar 29, 2017

The solution for me was to import my custom providers in each page module that I need them in, as opposed to importing all of them in the app module.

Importing Ionic-native modules in the app module works fine.

@darthdie
Copy link

The problem with this approach is that it seems my providers are no longer singletons.

@brettatoms
Copy link
Contributor

My problem boiled down to the moment.js library. When it's being used then code splitting breaks you start getting the dreaded undefined is not a function error.

@rapropos
Copy link

FWIW I am also using moment.js.

@Manduro
Copy link
Contributor Author

Manduro commented Mar 29, 2017

@brettatoms Great, great catch, thanks for sharing!

@danbucholtz
I've updated my test repo to reproduce it correctly this time. https://github.com/Manduro/ionic-test

@rapropos
Copy link

See angular-cli #2496 for more info.

@rapropos
Copy link

Ditching moment in favor of date-fns seems to have fixed me.

@brettatoms
Copy link
Contributor

brettatoms commented Mar 30, 2017

For now you can work around this by adding node_modules/moment/moment.js to the includes in your tsconfig.json file and replace any moment imports in your code with declare var moment;

Edit: Nevermind

@danbucholtz
Copy link
Contributor

@rapropos,

What a weird issue with Moment. Any thoughts on it? I am going to take a look. It seems strange to me since we're letting Webpack do the heavy lifting there.

Hmmm.

Thanks,
Dan

@rapropos
Copy link

rapropos commented Mar 30, 2017

@danbucholtz: The most comprehensive resource I have come across to date, which I suspect is also where @brettatoms found this (major props to you on this, BTW) is angular-cli #2496 as mentioned above. I cannot independently confirm that all wildcard imports silently break code splitting or not, but at least in my case, any occurrence of import * as moment from "moment" did. As I also said upthread:

I also note that the conference app has a bunch of [n].main.js files in www/build that appear to be code splitting artifacts, whereas my app does not have any of these.

...and corroborated by @Sh1d0w with:

I have observed that my project generates single main.js file, while the conference app have multiple split chunks of main.js, maybe that's something to do with it as well.

...so it seems pretty conclusive that whatever the root cause, failure to see webpack code splitting act as expected is a proximate cause for this issue.

BTW: I experimented with replacing System.import in ionic-angular/util/ng-module-loader's loadAndCompile() with import and require.ensure to no avail, although I was a bit concerned about System.import being apparently deprecated. I assume that you are far more well versed in these matters than I am, so you probably have good reasons for things being the way they are.

@zarko-tg
Copy link

zarko-tg commented Mar 30, 2017

I can confirm that "undefined is not a function" runtime error related to module loading.

Made a simple app based on the sidemenu template (using ng4/ionic3 and lazy loading). The app fails right on first load as soon as I have installed angular2-moment and specified MomentModule in the imports section of app.module.ts. Note, I am testing this running via the usual "ionic serve".
Remove it from there and everything is back to normal.

Looking forward to advice on proper solution / fix and best practices moving forward.

p.s. Here's the archive of the app if anyone wants to have a look: https://drive.google.com/file/d/0B4eB_Qz7OSaTZUZPWktLdWRlR2s/view?usp=sharing

Update [31.03.2017]: The newly released @ionic/app-scripts@1.2.5 solved this particular problem. Thanks @danbucholtz!

@numerized
Copy link

Thanks for this, having same issue, tried many different things, no real progress.

@brettatoms
Copy link
Contributor

@rapropos I wish I had found the problem in that angular-cli issue but unfortunately is was through a LOT of trial and error.

The problem doesn't happen with all wildcard imports since we're also doing import _ from lodash with no problems.

@brettatoms
Copy link
Contributor

Looks like I'm having the same issue with chart.js.

@Manduro
Copy link
Contributor Author

Manduro commented Mar 30, 2017

This is the corresponding PR that has fixed the angular-cli issue that was mentioned. Maybe that's something to work with?

angular/angular-cli#4153

@mhartington
Copy link
Contributor

Yep, we're aware of the PR. Currently looking into it and seeing if this will help for us.

@rapropos
Copy link

It's interesting that the ng-cli PR seems to be AoT-specific. I was bit by this issue even without using ngc, just on a straight dev build.

@danbucholtz
Copy link
Contributor

danbucholtz commented Mar 31, 2017

This is fixed. Please test and let me know how it goes.

npm install @ionic/app-scripts@latest --save --save-exact

As for the System.import, we really could use either import or System.import. I'm sure we'll switch over at some point. Webpack polyfills both. The reason we went with System.import is in our testing with Closure Compiler it uses a System.import polyfill.

Thanks,
Dan

@Sh1d0w
Copy link

Sh1d0w commented Mar 31, 2017

@danbucholtz Thanks! I can confirm it is fixed now for my project.

@abdel-ships-it
Copy link
Contributor

@jamesbenns I agree with you. And because I consider​ ionic to be a super cutting edge framework, Im sure ionic page modules will work better in the future.

@johneast
Copy link

johneast commented May 17, 2017

I'm having the same issue. I have an ionic app that works fine. I use the ionic cli to generate a new page, I then import the page module in app.module, without adding any code to the page, and I get the error.

Uncaught (in promise): TypeError: Array.prototype.map callback must be a function

Environment setup:

Ionic Framework: 3.2.0
Ionic App Scripts: 1.3.7
Angular Core: 4.1.0
Angular Compiler CLI: 4.1.0
Node: 7.7.1
OS Platform: macOS Sierra
Navigator Platform: MacIntel
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30

I can get around the issue by removing the page module created by the cli and reference the page directly in app.module, but this means it's actually easier for me to create pages manually rather than using the cli.

@MarkySparky
Copy link

Exactly the same issue here. I'm going back to chucking the pages in app.module for now.

Error:

Runtime Error
Uncaught (in promise): TypeError: undefined is not a function TypeError: undefined is not a function at Array.map (native) at webpackAsyncContext (http://localhost:8100/build/main.js:74105:34) at loadAndCompile (http://localhost:8100/build/main.js:73181:36) at NgModuleLoader.load (http://localhost:8100/build/main.js:73146:83) at ModuleLoader.load (http://localhost:8100/build/main.js:55211:44) at DeepLinker.getNavLinkComponent (http://localhost:8100/build/main.js:26281:39) at DeepLinker.getComponentFromName (http://localhost:8100/build/main.js:26264:25) at getComponent (http://localhost:8100/build/main.js:29339:23) at convertToView (http://localhost:8100/build/main.js:29357:16) at convertToViews (http://localhost:8100/build/main.js:29376:32)

ionic info:

global packages:

    @ionic/cli-utils : 1.1.2
    Ionic CLI        : 3.1.2

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-ionic-angular : 1.1.2
    Ionic Framework                 : ionic-angular 3.2.1

@zjhiphop
Copy link

zjhiphop commented Jun 1, 2017

Got same issue, my ionic env is:

Your system information:

    Cordova CLI: 6.5.0
    Ionic Framework Version: 3.3.0
    Ionic CLI Version: 3.0.0-beta.4
    ios-deploy version: 1.7.0
    ios-sim version: 4.1.1
    OS: macOS Sierra
    Node Version: v7.7.3
    Xcode version: Xcode 8.1 Build version 8B62

@marxxxx
Copy link

marxxxx commented Jun 5, 2017

Same problem here when navigating using a string instead of a reference to a page component.

I'm not using any third party librarys, just pure ionic 3.

 Runtime Error
Uncaught (in promise): TypeError: undefined is not a function TypeError: undefined is not a function 
at Array.map (native) 
at webpackAsyncContext (http://localhost:8100/build/main.js:74778:34) 
at loadAndCompile (http://localhost:8100/build/main.js:73758:36) 
at NgModuleLoader.load (http://localhost:8100/build/main.js:73723:83) 
at ModuleLoader.load (http://localhost:8100/build/main.js:55474:44) 
at DeepLinker.getNavLinkComponent (http://localhost:8100/build/main.js:26907:39) 
at DeepLinker.getComponentFromName (http://localhost:8100/build/main.js:26890:25) 
at getComponent (http://localhost:8100/build/main.js:29965:23) 
at convertToView (http://localhost:8100/build/main.js:29983:16) 
at convertToViews (http://localhost:8100/build/main.js:30002:32)

Error: Uncaught (in promise): TypeError: undefined is not a function TypeError: undefined is not a function at Array.map (native) at webpackAsyncContext (http://localhost:8100/build/main.js:74778:34) at loadAndCompile (http://localhost:8100/build/main.js:73758:36) at NgModuleLoader.load (http://localhost:8100/build/main.js:73723:83) at ModuleLoader.load (http://localhost:8100/build/main.js:55474:44) at DeepLinker.getNavLinkComponent (http://localhost:8100/build/main.js:26907:39) at DeepLinker.getComponentFromName (http://localhost:8100/build/main.js:26890:25) at getComponent (http://localhost:8100/build/main.js:29965:23) at convertToView (http://localhost:8100/build/main.js:29983:16) at convertToViews (http://localhost:8100/build/main.js:30002:32) at c (http://localhost:8100/build/polyfills.js:3:13190) at Object.reject (http://localhost:8100/build/polyfills.js:3:12546) at NavControllerBase._fireError (http://localhost:8100/build/main.js:43667:16) at NavControllerBase._failed (http://localhost:8100/build/main.js:43655:14) at http://localhost:8100/build/main.js:43710:59 at t.invoke (http://localhost:8100/build/polyfills.js:3:8971) at Object.onInvoke (http://localhost:8100/build/main.js:4406:37) at t.invoke (http://localhost:8100/build/polyfills.js:3:8911) at r.run (http://localhost:8100/build/polyfills.js:3:4140) at http://localhost:8100/build/polyfills.js:3:13731

`global packages:

@ionic/cli-utils : 1.3.0
Ionic CLI        : 3.3.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-ionic-angular : 1.3.0
Ionic Framework                 : ionic-angular 3.3.0`

@Sh1d0w
Copy link

Sh1d0w commented Jun 11, 2017

Seems broken again with just creating new ionic 3 project and generating 2 new pages. No extra libs installed. @danbucholtz

@Lothrazar
Copy link

Lothrazar commented Jun 21, 2017

UPDATE: read my reply, this error is fixable

Happens for me as well. Have an existing app where pages work just fine the old way, but now converting them to use @IonicPage decorator and modules.

However i get two different errors depending how i load the problem page. If i enter using the /#/notifications url route, i get this error

core.es5.js:1084 ERROR Error: Uncaught (in promise): invalid views to insert at c (polyfills.js:3) at Object.reject (polyfills.js:3) at NavControllerBase._fireError (nav-controller-base.js:322) at NavControllerBase._failed (nav-controller-base.js:310) at nav-controller-base.js:365 at t.invoke (polyfills.js:3) at Object.onInvoke (core.es5.js:4128) at t.invoke (polyfills.js:3) at r.run (polyfills.js:3) at polyfills.js:3

If i try to nav into the page using the ionicpage decorator, as a string, that is

nav.push('notifications')

i get a different Error
core.es5.js:1084 ERROR Error: Uncaught (in promise): TypeError: undefined is not a function TypeError: undefined is not a function at Array.map (native) at webpackAsyncContext (http://localhost:8100/build/main.js:162535:34) at loadAndCompile (http://localhost:8100/build/main.js:143320:36) at NgModuleLoader.load (http://localhost:8100/build/main.js:143285:83) at ModuleLoader.load (http://localhost:8100/build/main.js:111473:44) at DeepLinker.getNavLinkComponent (http://localhost:8100/build/main.js:74663:39) at DeepLinker.getComponentFromName (http://localhost:8100/build/main.js:74646:25) at getComponent (http://localhost:8100/build/main.js:79998:23) at convertToView (http://localhost:8100/build/main.js:80016:16) at convertToViews (http://localhost:8100/build/main.js:80035:32) ...

Page decorators

@ IonicPage({
 name: 'notifications'
})
@ Component({
 selector: 'notifications',
 templateUrl: 'notifications.html',
})
export class NotificationsPage implements OnInit { ... 

Module for my page


import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { SharedModule } from '../../app/shared.module';
import { NotificationsPage } from './notifications';
@NgModule({
  declarations: [
    NotificationsPage
  ],
  imports: [
     IonicPageModule.forChild(NotificationsPage),
    SharedModule
  ],
  entryComponents: [],
  providers: [],
  exports: [NotificationsPage],
})

export class NotificationsModule { }

My package info

global packages:

@ionic/cli-utils : 1.0.0
Cordova CLI      : 6.5.0
Gulp CLI         : CLI version 3.9.1 Local version 3.9.1
Ionic CLI        : 3.0.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-gulp          : 1.0.1
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.1.2 browser 4.1.0 ios 4.3.1
Ionic Framework                 : ionic-angular 3.3.0

System:

Node       : v6.7.0
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.0
ios-sim    : 5.0.8

@Lothrazar
Copy link

Re: my previous comment: I got this working without updating or changing any packages. Not sure how exactly just trying different things. I have a shared module with a huge ton of services and pages, so one change I made was moving the BrowserModule out of shared and having it directly in app.module. Also I added entryComponents: [NotificationsPage], on the page module.

Anyway I hope this info helps somebody.

@iget-master
Copy link

iget-master commented Jun 22, 2017

We are having the same issue here, looks like not solved yet.

I'm creating the page using ionic g page MyPage.

If I try to call the page using
this.nav.setRoot('MyPage')

it fails. But if I use
this.nav.setRoot(MyPage) // the reference to the component, not a string
it works.


My issue is the same of @PrinceOfAmber. Noticed also that it only occurs if I declare more then one page on my App Module.


Tried using the @danbucholtz latest app-scripts version with no success.

@iget-master
Copy link

@danbucholtz The things are broken here, could you reopen the issue?

@mhartington
Copy link
Contributor

Please provide a minimal example project to inspect.

@iget-master
Copy link

@mhartington

I've just provided the steps to reproduce on main git (not sure if this is a app-scripts problem)
ionic-team/ionic-framework#12136

@iget-master
Copy link

@mhartington

Tried to create a plunker to reproduce, but looks like IonicPage don't work over plunker, the error is "Invalid link: First Page".

http://plnkr.co/edit/Puzkvf

But reproducing the bug using ionic serve is very fast.

@mhartington
Copy link
Contributor

Put together a demo and push to github then.

@kael
Copy link

kael commented Jun 27, 2017

I'm encountering the same issue using ionic 3.4.0.

I've posted a sample app demonstrating the bug @ https://github.com/kael/ionic-deeplinking-bug-demo

I've also tried by adding imports: [NavigationPageModule] in app.module.ts as mentioned in that SO response (but not mentioned in the @IonicPage doc) but unsuccessfully.

Seems I have to fallback to the former navigation mechanism.

@mhartington
Copy link
Contributor

mhartington commented Jun 27, 2017

@kael your project was not setup correctly. Lazy-loaded pages should not be declared in the app-module, as you had.

After applying the fix, and letting things build, I was able to load localhost:8100 then manually enter localhost:8100/#/navigation and it worked fine.

Please see my blog posts that go into detail about lazy loading.

http://blog.ionic.io/ionic-and-lazy-loading-pt-1/
http://blog.ionic.io/ionic-and-lazy-loading-pt-2/

kael/ionic-deeplinking-bug-demo#1

@kael
Copy link

kael commented Jun 27, 2017

@mhartington: thank you very much for the fix.

There's still an issue as mentioned on the PR page, when appending directly the path to the host in the address bar (but for my use that won't be a problem).

Cheers.

@mhartington
Copy link
Contributor

Interesting. If you load the localhost:8100, then manually apply the #/navigation slug, it errors. If you open a new tab, and load locahost:8100/#/navigation it loads fine.

I installed nightly and it seems to be fixed. Though the urls have changed a bit.

@danbucholtz
Copy link
Contributor

URLs are in phase one of two as we build out a PWA story. They are going to change a bit in 3.5.0 which ships tomorrow and likely going to shrink down again in the next release after that.

Thanks,
Dan

@Sh1d0w
Copy link

Sh1d0w commented Jun 28, 2017

Guys we really appreciate your effort and the great stuff you are doing with Ionic. However don't you feel that Ionic is a big framework, used by a lot of projects nowadays and promoting something broken in official release is not a good practice? I mean you always rush to announce cool stuff which then don't work for like 5 releases ahead until it gets properly fixed and ready to use in production?

My point is: if you are going constantly to change and rewrite the framework, add new things or deprecate old ones, then please do it as a dev or beta release, don't do regular releases which then appears to be broken. General public should always use what is stable.

We get a bunch of nice fixes in a release, and a bunch of not working and not ready for production features. Then the developer has to decide if he wants to upgrade to get those nice fixes or wait 4-5 releases to get the new stuff fixed. It will be much nice if you just release a dev or beta previews so users can test them if they want, but officially release and include this feature when it is bullet proof. Otherwise you are only causing problems with production builds.

I am focusing here Lazy loading and virtual scroll, but it could apply for anything new you want to introduce in future.

@danbucholtz @mhartington

@danbucholtz
Copy link
Contributor

By all means, feel free not to upgrade or wait until the next release. We fixed a ton of navigation bugs, but as a result we had to change the url a bit. We feel that it's better to ship the fixes now than to wait. We will likely be able to shrink the url down some in the near future, and then set-it-and-forget it. There are very few people who are using the url today so it isn't a big deal compared to the many, many, many devs using Ionic via Cordova.

Thanks,
Dan

@Sh1d0w
Copy link

Sh1d0w commented Jun 28, 2017

@danbucholtz Please pay attention to my last sentence in my previous post. It was not related directly to your last comment regarding URLs it was more towards releasing unstable stuff in prod.

You can't tell developers "feel free to not upgrade", when this release provides a fixes for previously released unstable stuff for example.

Once again I don't mean to argue, I really appreciate all work you are doing, I just think your release lifecycle is very wrong.

For example I do lectures where I present Ionic to another developers. When someone decides to give it a try and he for example wants to test Lazy loading feature and he sees it is broken, what impressions are you leaving in him?

What Ionic should provide is a rock solid solution, instead of always changing an unreliable releases.

@danbucholtz @mlynch

@Sh1d0w
Copy link

Sh1d0w commented Jun 28, 2017

As a side note if there is still a confusion what I am talking about it is not even about upgrading from one release to another.

Same applies for newcomers that just create their first Ionic project. See my comment here #848 (comment) and this thread in general.

With just a blank starter app, used ionic-cli to generate two new pages without installing anything else, and just following the blog post about lazy loading it just not works.

This is what I am talking about.

@abdel-ships-it
Copy link
Contributor

@Sh1d0w Is it still broken for you? Because it works fine for me on a project I created today

This is my ionic info output.

global packages:

    @ionic/cli-utils : 1.0.0-rc.2-alpha.f5850eb3
    Cordova CLI      : 6.5.0
    Ionic CLI        : 3.0.0-rc.2-alpha.f5850eb3

local packages:

    @ionic/app-scripts              : 1.3.12
    @ionic/cli-plugin-cordova       : 1.4.0-alpha.e838a5d7
    @ionic/cli-plugin-ionic-angular : 1.3.1-alpha.e838a5d7
    Cordova Platforms               : none
    Ionic Framework                 : ionic-angular 3.5.0

System:

    Node       : v6.9.5
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b
    ios-deploy : not installed
    ios-sim    : not installed

@basvdijk
Copy link

basvdijk commented Jul 5, 2017

I have the same problem, repo at https://github.com/basvdijk/ionic-module-test when you open the sidebar and click the test entry I'll get:

Runtime Error
Uncaught (in promise): TypeError: undefined is not a function TypeError: undefined is not a function at Array.map (<anonymous>) at webpackAsyncContext (http://localhost:8100/build/main.js:74580:34) at loadAndCompile (http://localhost:8100/build/main.js:73742:36) at NgModuleLoader.load (http://localhost:8100/build/main.js:73707:83) at ModuleLoader.load (http://localhost:8100/build/main.js:56081:44) at DeepLinker.getNavLinkComponent (http://localhost:8100/build/main.js:26699:39) at DeepLinker.getComponentFromName (http://localhost:8100/build/main.js:26682:25) at getComponent (http://localhost:8100/build/main.js:29762:23) at convertToView (http://localhost:8100/build/main.js:29782:16) at convertToViews (http://localhost:8100/build/main.js:29801:32)
Error: Uncaught (in promise): TypeError: undefined is not a function
TypeError: undefined is not a function
    at Array.map (<anonymous>)
    at webpackAsyncContext (http://localhost:8100/build/main.js:74580:34)
    at loadAndCompile (http://localhost:8100/build/main.js:73742:36)
    at NgModuleLoader.load (http://localhost:8100/build/main.js:73707:83)
    at ModuleLoader.load (http://localhost:8100/build/main.js:56081:44)
    at DeepLinker.getNavLinkComponent (http://localhost:8100/build/main.js:26699:39)
    at DeepLinker.getComponentFromName (http://localhost:8100/build/main.js:26682:25)
    at getComponent (http://localhost:8100/build/main.js:29762:23)
    at convertToView (http://localhost:8100/build/main.js:29782:16)
    at convertToViews (http://localhost:8100/build/main.js:29801:32)
    at c (http://localhost:8100/build/polyfills.js:3:13190)
    at Object.reject (http://localhost:8100/build/polyfills.js:3:12546)
    at NavControllerBase._fireError (http://localhost:8100/build/main.js:44151:16)
    at NavControllerBase._failed (http://localhost:8100/build/main.js:44139:14)
    at http://localhost:8100/build/main.js:44194:59
    at t.invoke (http://localhost:8100/build/polyfills.js:3:8971)
    at Object.onInvoke (http://localhost:8100/build/main.js:4427:37)
    at t.invoke (http://localhost:8100/build/polyfills.js:3:8911)
    at r.run (http://localhost:8100/build/polyfills.js:3:4140)
    at http://localhost:8100/build/polyfills.js:3:13731
global packages:

    @ionic/cli-utils : 1.4.0
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.12
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Ionic Framework                 : ionic-angular 3.5.0

System:

    Node       : v7.2.0
    OS         : OS X El Capitan
    Xcode      : Xcode 8.2.1 Build version 8C1002
    ios-deploy : not installed
    ios-sim    : 5.0.13
    npm        : 4.0.5

@mhartington
Copy link
Contributor

@basvdijk your demo repo does not actually include any lazy loading at all. Not sure if you pushed the wrong code up or something. The way to repo currently is setup, you would never have that issue.

@basvdijk
Copy link

basvdijk commented Jul 5, 2017

@mhartington Sorry seems I have forgotten to push my changes. Please pull for a version with the test module.

@mhartington
Copy link
Contributor

Similar to another example posted here, your setup is not correct.

@@ -6,7 +6,6 @@ import { MyApp } from './app.component';
 import { HomePage } from '../pages/home/home';
 import { ListPage } from '../pages/list/list';
 
-import { TestModule } from '../test/test.module';
 
 import { StatusBar } from '@ionic-native/status-bar';
 import { SplashScreen } from '@ionic-native/splash-screen';
@@ -18,7 +17,6 @@ import { SplashScreen } from '@ionic-native/splash-screen';
     ListPage
   ],
   imports: [
-    TestModule,
     BrowserModule,
     IonicModule.forRoot(MyApp),
   ],

You don't import the module for the lazy loaded page at all.

basvdijk added a commit to basvdijk/ionic-module-test that referenced this issue Jul 5, 2017
@basvdijk
Copy link

basvdijk commented Jul 5, 2017

@mhartington I see, thanks for clarifying!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests