执行ng build --prod
后,我无法打开子模块(延迟加载)。
market.module.js
不是由构建生成的。
错误:
zone.js:1263 GET http://192.168.1.10/dist/app/+market/market.module.js 404 (Not Found)
环境:
angular-cli: 1.0.0-beta.10
node: 6.3.1
os: linux x64
app.routing.ts:
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { CompanyGuard } from './shared/guards/company.guard';
const appRoutes: Routes = [
{
path: 'company/:company_id',
children: [
{
path: 'market',
loadChildren: 'app/+market/market.module#MarketModule',
}
],
canActivate: [ CompanyGuard ]
}
];
export const appRoutingProviders: any[] = [
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);