Closed Daskus1 closed 7 years ago
I'm having a similar issue here, the same function errors. https://github.com/driftyco/ionic-app-scripts/issues/848.
@Daskus1,
How can I reproduce this? Can you do me a favor and open node_modules/ionic-angular/index.js
and add a console.log('deepLinkConfig: ', deepLinkConfig);
at the top of the IonicModule.forRoot
function call. It seems like the @IonicPage()
config is getting corrupted somehow. We have a lot of tests around this stuff so I am surprised. Once we identify what the issue is, I'll add some additional tests.
CC: @Manduro please do the same and share here.
Thanks, Dan
@danbucholtz I added JSON.stringify to the console.log, and it outputs the following:
deepLinkConfig: {"links":[
(...)
{
"loadChildren":"..pagesloginlogin.module#LoginPageModule",
"name":"LoginPage",
"segment":null,
"priority":"low",
"defaultHistory":[]
},
(...)
{
"loadChildren":"..pageswelcomewelcome.module#WelcomePageModule",
"name":"WelcomePage",
"segment":null,
"priority":"low",
"defaultHistory":[]
},
(...)
]}
But it seems like there is an issue with the path. All paths with either a 't', 'r', or 'f' as first character have a backslash. I think that windows is making trouble here with double backslash, but I'm not sure. Here an example:
{
"loadChildren":"..pages\tabs\tabs.module#TabsPageModule",
"name":"TabsPage",
"segment":null,
"priority":"low",
"defaultHistory":[
]
}
EDIT: In the outputted object it looks like this:
"..pages abs abs.module#TabsPageModule"
The same for: "..pages\reminder\reminder-new.module#ReminderNewPageModule"
Idk what you could do to reproduce this since I get this errors in every project, even in a totally new generated one.
Hope this helps, if you need more info I'm happy to help.
After adding the following code at the top of IonicModule.forRoot
in node_modules/ionic-angular/index.js
it finds a match in the map, but then throws the same error as @Manduro gets in driftyco/ionic-app-scripts#848.
ERROR TypeError: undefined is not a function
for(var i=0; i<deepLinkConfig.links.length; i++){
if(deepLinkConfig.links[i].loadChildren === "..pagesloginlogin.module#LoginPageModule"){
deepLinkConfig.links[i].loadChildren = "..\\pages\\login\\login.module#LoginPageModule";
}
}
Fyi, if this helps, seems to be a Windows only issue. I was able to create a working app on OSX, but get this same error using the exact same code on Windows.
@danbucholtz @Daskus1 So let's handle the undefined is not a function
as a separate issue to this one, as this issue seems to be related to paths on Windows. I'm posting my deeplinkconfig output there.
Quick fix in node_modules\@ionic\app-scripts\dist\deep-linking\util.js
replace backslashes with forward slashes in userlandModulePath
function convertDeepLinkEntryToJsObjectString(entry) {
entry.userlandModulePath = entry.userlandModulePath.replace(/\\/g, '/');
var defaultHistoryWithQuotes = entry.defaultHistory.map(function (defaultHistoryEntry) { return "'" + defaultHistoryEntry + "'"; });
var segmentString = entry.segment && entry.segment.length ? "'" + entry.segment + "'" : null;
return "{ loadChildren: '" + entry.userlandModulePath + LOAD_CHILDREN_SEPARATOR + entry.className + "', name: '" + entry.name + "', segment: " + segmentString + ", priority: '" + entry.priority + "', defaultHistory: [" + defaultHistoryWithQuotes.join(', ') + "] }";
}
This is fixed in 1.2.3
. npm install @ionic/app-scripts@latest
.
Thanks, Dan
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Ionic version: (check one with "x") [ ] 1.x [x] 2.x
I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior: I am trying to port my app to ionic3 using these instructions. But I am getting the following error when I push to a lazy loaded page:
Error: Cannot find module '..pagesloginlogin.module'.
I tried with multiple apps (my own, conference-app(lazy-load branch), blank app) but always get the same error.I think
"..pagesloginlogin.module"
is auto generated by Ionic when trying to find out which module to load when I callnav.push('LoginPage')
.Here is the full error:
webpackAsyncContext()
is throwing the error, because it can't find"..pagesloginlogin.module"
in the map. It seems like the path to the module is missing the slashes. If it would include the slashes ("..\pages\login\login.module") it probably would find a match in the map.Steps to reproduce:
Ionic info: (run
ionic info
from a terminal/cmd prompt and paste output below):