Skip to content

Lazy loading module #9880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
FARHANE opened this issue Mar 6, 2018 · 4 comments
Closed

Lazy loading module #9880

FARHANE opened this issue Mar 6, 2018 · 4 comments

Comments

@FARHANE
Copy link

FARHANE commented Mar 6, 2018

Versions

 _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.7.0
Node: 8.9.4
OS: win32 x64
Angular: 5.2.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.2.1
@angular/cli: 1.7.0
@angular/material-moment-adapter: 5.2.1
@angular/material: 5.2.1
@angular-devkit/build-optimizer: 0.3.1
@angular-devkit/core: 0.3.1
@angular-devkit/schematics: 0.3.1
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.0
@schematics/angular: 0.3.1
@schematics/package-update: 0.3.1
typescript: 2.6.2
webpack: 3.11.0

Repro steps

  • Step 1
export const routes: Routes = [
    {
        path: 'pages',
        component: PageComponent,
        children: [
            {
                path: 'session',
                loadChildren: "./session/session.module#SessionModule",

            },
        ]
    },

]

export const PagesRoutingModule: ModuleWithProviders = RouterModule.forChild(routes);

TypeError: __webpack_require__.e is not a function

Observed behavior

if I modify the loadChildren to

loadChildren: ()=> SessionModule

I get this error
Cannot read property 'loadChildren' of undefined

When do save on any file the project recompile and it's work but I can not do that when I am executing ng build

@FARHANE
Copy link
Author

FARHANE commented Mar 7, 2018

Hello,
I delete all additioanl comma ' , ' from my code

export const routes: Routes = [
    {
        path: 'pages',
        component: PageComponent,
        children: [
            {
                path: 'session',
                loadChildren: "./session/session.module#SessionModule"

            }
        ]
    }

]

and I add -aot to the serve commande it work but when I do ng build I have an empty page.

@michaeljota
Copy link

duplicate of #9825

There is a solution there.

@filipesilva
Copy link
Contributor

Closing as answered by @michaeljota, thank you!

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants