Skip to content
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

Error with dynamic import and lazy loading #92

Closed
devbenzy opened this issue Jun 26, 2019 · 1 comment
Closed

Error with dynamic import and lazy loading #92

devbenzy opened this issue Jun 26, 2019 · 1 comment

Comments

@devbenzy
Copy link

Hi,
I need to load some modules in the following way but its giving me an error "Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'." can you check and share a working sample ?

{
path: '',
component: WrapperComponent,
canActivateChild: [MetaGuard],
children: [{
path: 'home', loadChildren: () = {
//I need to write some logic here to decide which module it should load, for now i am simply returning the below.
return import('./home/home.module').then(mod => mod.HomeModule)
}

},
@Gorniv
Copy link
Member

Gorniv commented Jun 26, 2019

return import('./home/home.module').then(mod => mod.HomeModule)
this syntactic only for ivy or JIT
use: loadChildren: './mock-server-browser/mock-server-browser.module#MockServerBrowserModule',

@Gorniv Gorniv closed this as completed Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants