2017-05-18 1 views
0

Ich entwickle eine App mit Angular4 und .Net Core Mvc.Angular4 Webpack gibt Fehler wenn Produktion Env aber funktioniert auf Dev env

Wenn ich dev Bundle-Skript in package.json ausführen, funktioniert es. Script unten:

del-cli wwwroot/dist/js/app && webpack --config webpack.config.dev.js --progress --profile --watch 

Wenn ich prod Bündel Skript in package.json laufen gibt es Fehler unter:

app.module.ngfactory.ts ... 'Versprechen' bezieht sich nur auf einen Typ sondern wird als ein Wert verwendet wird, hier

Prod Skript ist unten:

del-cli wwwroot/dist/js/app && ngc -p tsconfig.aot.json && ngc -p tsconfig.aot.json && webpack --config webpack.config.prod.js --progress --profile --bail && del-cli 'wwwroot/dist/js/app/**/*.js' 'wwwroot/dist/js/app/**/*.js.map' '!wwwroot/dist/js/app/bundle.js' '!wwwroot/dist/js/app/*.chunk.js' 'ClientApp/app/**/*.ngfactory.ts' 'ClientApp/app/**/*.shim.ts' 'ClientApp/app/**/*.ngsummary.json' 'ClientApp/app/**/*.ngstyle.ts' 

Mein tscon fig.aot.json Datei unter:

"compilerOptions": { 
    "module": "es2015", 
    "target": "es5", 
    "lib": [ 
     "es2015", 
     "dom" 
    ], 
    "moduleResolution": "node", 
    "noImplicitAny": false, 
    "sourceMap": false, 
    "removeComments": false, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "outDir": "./wwwroot/dist/js/app" 
    }, 
    "types": [ "node", "lodash", "core-js" ], 
    "typeRoots": [ 
    "node_modules/@types" 
    ], 
    "angularCompilerOptions": { 
    "skipMetadataEmit": true 
    } 

ich den Fehler nicht verarbeiten kann, habe ich versucht, viele Dinge. Ich habe versucht, es2016, es2017 in lib Teil in tsconfig hinzufügen, hat aber nicht funktioniert.

Auch @ types/core-js Version in package.json ist 0.9.39.

"@types/core-js": "^0.9.39", 
"@types/lodash": "^4.14.59", 
"@types/node": "^6.0.45", 
"typescript": "^2.2.2" 

Können Sie mir helfen?

Vielen Dank im Voraus

Antwort

0

ich aot aber normal TSconfig Datei wirkt AOT Bündel bündeln wollte. So bereitete ich normale tsconfig Datei wie unten vor, Problem gelöst:

{ 
    "compileOnSave": false, 
    "compilerOptions": { 
    "module": "commonjs", 
    "target": "es5", 
    "lib": [ "es2016", "dom" ], 
    "moduleResolution": "node", 
    "noImplicitAny": false, 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "removeComments": false, 
    "skipLibCheck": true 
    }, 
    "exclude": [ 
    "node_modules", 
    "wwwroot/dist/js" 
    ] 
} 
Verwandte Themen