2017-11-14 11 views
0

지연로드 구성이있는 응용 프로그램을 가지고 있고 ng 서비스가 작동하지만 빌드를 수행하면 작동이 중지되고 오류가 발생하지 않습니다.Angular ng build 지연로드 지연로드

누락 된 프로세스가 있습니까? 나는 심지어 각도의 공식 문서를 읽고 무엇이든 놓치지 않는 것 같다.

각도 CLI 'ng new project-x'로 앱을 설치합니다. 최소 라이브러리가 있습니다.

여기 내 package.json입니다 :

{ 
    "name": "single-boilerplate", 
    "version": "0.0.0", 
    "license": "MIT", 
    "scripts": { 
    "ng": "ng", 
    "start": "ng serve", 
    "build": "ng build", 
    "test": "ng test", 
    "lint": "ng lint", 
    "e2e": "ng e2e" 
    }, 
    "private": true, 
    "dependencies": { 
    "@angular-redux/store": "^6.5.7", 
    "@angular/animations": "^4.2.4", 
    "@angular/common": "^4.2.4", 
    "@angular/compiler": "^4.2.4", 
    "@angular/core": "^4.2.4", 
    "@angular/forms": "^4.2.4", 
    "@angular/http": "^4.2.4", 
    "@angular/platform-browser": "^4.2.4", 
    "@angular/platform-browser-dynamic": "^4.2.4", 
    "@angular/router": "^4.2.4", 
    "@ngx-translate/core": "^8.0.0", 
    "@ngx-translate/http-loader": "^2.0.0", 
    "core-js": "^2.4.1", 
    "font-awesome": "^4.7.0", 
    "ng2-validation": "^4.2.0", 
    "redux": "^3.7.2", 
    "rxjs": "^5.4.2", 
    "zone.js": "^0.8.14" 
    }, 
    "devDependencies": { 
    "@angular/cli": "^1.5.0", 
    "@angular/compiler-cli": "^4.2.4", 
    "@angular/language-service": "^4.2.4", 
    "@types/es6-shim": "^0.31.35", 
    "@types/jasmine": "~2.5.53", 
    "@types/jasminewd2": "~2.0.2", 
    "@types/node": "^6.0.90", 
    "codelyzer": "~3.2.0", 
    "jasmine-core": "~2.6.2", 
    "jasmine-spec-reporter": "~4.1.0", 
    "karma": "~1.7.0", 
    "karma-chrome-launcher": "~2.1.1", 
    "karma-cli": "~1.0.1", 
    "karma-coverage-istanbul-reporter": "^1.2.1", 
    "karma-jasmine": "~1.1.0", 
    "karma-jasmine-html-reporter": "^0.2.2", 
    "protractor": "~5.1.2", 
    "ts-node": "~3.2.0", 
    "tslint": "~5.7.0", 
    "typescript": "~2.3.3" 
    } 
} 

이 내 주요 라우터 : 지금 문제가 무엇인지 모릅니다

export const AppRoutes: Routes = [ 
    { 
    path: '', 
    component: AppComponent, 
    children: [ 
     { path: '', loadChildren: './components/dashboard/dashboard.module#DashboardModule' } 
    ] 
    }, 
    { 
    path: '', 
    component: AuthComponent, 
    children: [ 
     { path: '', loadChildren: './components/auth/auth.module#AuthModule' } 
    ] 
    }, 
    { 
    path: '**', 
    redirectTo: '404' 
    } 
]; 

. 이 일이 당신 누구에게나 일어 났습니까?

답변

0

해결 방법 1

에 한번 당신의 package.lock.json (또는 yarn.lock.json) 파일을 삭제하여 node_modules 폴더를 삭제, 당신이 하나가 나타나지 않습니다 (당신의 package.json 파일에 웹팩에 대한 참조를 제거 할 수 있지만 당신이 할 수있는 ' CLI를 통해 제공된 두 가지 버전의 webpack이 설치되어있는 경우) npm install을 실행하십시오.

두 버전의 webpack이 설치되어 있는지 확인하는 방법은 npm ls webpack을 실행하는 것이지만 package.json에 저장하지 않은 경우 다시는 나타나지 않습니다.

나는이 솔루션을 Github에 발견했으며, 저와 분명히 다른 몇 포스터에서 작동했습니다.

솔루션이

또한 위의 방법으로 문제가 해결되지 않을 경우 어떤 사람들은 단순히 4.x를 최신 버전으로 업데이트 것으로 보인다.

+0

답장을 보내 주셔서 감사합니다. –

+0

앱이 같은 방법으로로드되지만 내가/로그인과 같은 URL에 액세스하려고하면 404가 발견되지 않습니다. @mtpultz –

+0

인증 모듈의 라우팅은 어떻게됩니까? 이처럼 – mtpultz