Unable to find module with ID


#1

Hi friends.
I’m new here and beginner with this framework. I’m creating a application and using router, but my application return this error. “Unable to find module with ID: home/index”.

My scr folder has the following structure.

-src
----home
--------index.js
--------index.html
----app.js
----app.html

And my app.js

config.map([
{ route: [’’, ‘home’], name: ‘home’, moduleId: ‘home/index’, nav: true, title: ‘Home’ },
{ route: ‘users’, name: ‘users’, moduleId: ‘users/index’, nav: true, title: ‘Users’ }
]);

I followed the following step by step and got the same error.

I am Brazilian, I apologize for any mistake in writing in English.

Thank you for any help.


#2

I guess you are using webpack. If so, the issue you described is because webpack wasn’t told to include the modules you want in the bundle. You can signal webpack by wrapping your moduleId with PLATFORM.moduleName():

config.map([
  { route: ['', 'home'], name: 'home', moduleId: PLATFORM.moduleName('home/index'), nav: true, title: 'Home' },
  { route: 'users', name: 'users', moduleId: PLATFORM.moduleName('users/index'), nav: true, title: 'Users' }
]);

#3

Hi friend, thank you for help. It’s work now.