2017-11-16 5 views
2

모든 SPA를 Angular 4에서 Angular 5로 업데이트했습니다. 지금까지 그렇게 잘 작동합니다. dev와 prod는 매우 잘 작동합니다. 오류나 경고가 없습니다.각도 5 uglifying build returns error

--prod 플래그가있는 SPA를 빌드하면 angular-cli이 빌드를 이해합니다. angular-cli에서 오류가 없습니다. 하지만 내 브라우저에서 SPA를 열면 오류가 발생하며 아무 일도 일어나지 않습니다. 페이지가 전혀로드되지 않습니다 (스피너 만로드). 여기

Uncaught Error: Unexpected value 'Ie' imported by the module 't'. Please add a @NgModule annotation. 
at c (compiler.js:466) 
at compiler.js:15088 
at Array.forEach (<anonymous>) 
at t.getNgModuleMetadata (compiler.js:15071) 
at t.getNgModuleSummary (compiler.js:14998) 
at compiler.js:15086 
at Array.forEach (<anonymous>) 
at t.getNgModuleMetadata (compiler.js:15071) 
at t._loadModules (compiler.js:33486) 
at t._compileModuleAndComponents (compiler.js:33447) 

은 내 package.json 모든 종속성 내 빌드 스크립트 : .angular-cli.json

{ 
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 
    "project": { 
    "name": "broadcast" 
    }, 
    "apps": [ 
    { 
     "root": "src", 
     "outDir": "../public/frontend", 
     "assets": [ 
     "assets", 
     ".htaccess", 
     "favicon.ico", 
     { 
    "glob": "**/*", 
    "input": "../node_modules/font-awesome/fonts/", 
    "output": "./assets/fonts/" 
} 
     ], 
     "index": "index.html", 
     "main": "main.ts", 
     "polyfills": "polyfills.ts", 
     "test": "test.ts", 
     "tsconfig": "tsconfig.app.json", 
     "prefix": "bm-", 
     "environmentSource": "environments/environment.ts", 
     "environments": { 
     "main": "environments/environment.ts" 
     } 
    } 
    ], 
    "lint": [ 
    { 
     "project": "src/tsconfig.app.json" 
    } 
    ], 
    "defaults": { 
    "styleExt": "css", 
    "component": { 
    } 
    }, 
    "warnings": { 
    "typescriptMismatch": false 
    } 
} 

이 어떻게 무슨 일이 일어나고 있는지 디버깅 할 수 있습니다 내 여기에

{ 
    "name": "broadcast-manager", 
    "version": "0.1.0", 
    "license": "MIT", 
    "scripts": { 
     "ng": "ng", 
     "dev": "ng serve --dev --environment main --port 1337 --host 0.0.0.0 --proxy-config proxy.conf.json", 
     "prod": "ng build --prod --environment main --aot false" 
    }, 
    "private": true, 
    "dependencies": { 
     "@angular/animations": "^5.0.1", 
     "@angular/cli": "^1.5.0", 
     "@angular/common": "^5.0.1", 
     "@angular/compiler": "^5.0.1", 
     "@angular/compiler-cli": "^5.0.1", 
     "@angular/core": "^5.0.1", 
     "@angular/forms": "^5.0.1", 
     "@angular/http": "^5.0.1", 
     "@angular/platform-browser": "^5.0.1", 
     "@angular/platform-browser-dynamic": "^5.0.1", 
     "@angular/router": "^5.0.1", 
     "@swimlane/ngx-charts": "^6.1.0", 
     "@swimlane/ngx-datatable": "^11.0.4", 
     "@types/jwt-decode": "^2.2.1", 
     "@types/node": "^8.0.53", 
     "bootstrap": "4.0.0-alpha.6", 
     "codelyzer": "^4.0.1", 
     "core-js": "^2.5.1", 
     "d3": "^4.11.0", 
     "jwt-decode": "2.2.0", 
     "moment": "^2.19.2", 
     "ng2-dnd": "^4.2.0", 
     "ngx-bootstrap": "^2.0.0-beta.8", 
     "ngx-chips": "^1.5.9", 
     "node-sass": "^4.6.1", 
     "protractor": "^5.2.0", 
     "rxjs": "^5.5.2", 
     "ts-node": "^3.3.0", 
     "tslint": "^5.8.0", 
     "typescript": "^2.6.1", 
     "zone.js": "^0.8.18" 
    }, 
    "devDependencies": {} 
} 

그리고는/무엇이 잘못이야?

+0

버전 변경으로 인한 것일 수 있습니다. 그 문제에 대해 살펴 보셨습니까? –

+0

광산과 같은 문제가 발견되지 않았습니다. 적어도 아직은. –

+0

누군가가 Angular CLI Github [repo] (https://github.com/angular/angular-cli/issues/8505)에서이 문제를보고했는데 아마도 관련이 있습니까? –

답변

0

@Kevin RED 덕분에 다음과 같은 쉬운 해결책으로 문제가 해결되었습니다.

하기 전에 :

"scripts": { 
    "prod": "ng build --prod --aot false" 
} 

후 :

"scripts": { 
    "prod": "ng build --prod --aot false --build-optimizer=false" 
} 

지금은 build-optimizer의 기능 (npmjs-build-optimizer)이 무엇인지 모르겠지만, 나는 true로 설정하면, 나는를받을 오류. false에 설정하면 작동합니다.