X
X
xenofobius2018-05-22 17:04:45
Angular
xenofobius, 2018-05-22 17:04:45

How to change the path of routing chunks in Angular5?

I compile the application
ng build --env=dev --aot --deploy-url=/static/
After compiling the page is loaded and the compiled js files are taken from the static folder, but not the pieces for lazy loading, they are taken from /, how can I fix this? routing looks like this:

const appRoutes: Routes = [
  {path: '', component: HomeComponent},
  {path: 'personal-area', loadChildren: './personal-area/personal-area.module#PersonalAreaModule', canActivate: [AuthGuard]},
  {path: 'auth', loadChildren: './auth/auth.module#AuthModule'},
];

@NgModule({
  imports: [
    RouterModule.forRoot(appRoutes, {preloadingStrategy: PreloadAllModules})
  ],
  exports: [
    RouterModule
  ],
  providers: [
    AuthGuard,
  ]
})

Here is where it expects to see the file:
5b04224a1102c684618488.png
And of course if you run it with base href="/static/" then everything is ok

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question