I am developing an app with Angular4 and .Net Core Mvc.
When I run dev bundle script in package.json it works. Script is below:
del-cli wwwroot/dist/js/app && webpack --config webpack.config.dev.js --progress --profile --watch
When I run prod bundle script in package.json it gives error below:
app.module.ngfactory.ts ... 'Promise' only refers to a type but is being used as a value here
Prod script is below:
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'
My tsconfig.aot.json file is below:
"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
}
I cannot handle the error, I tried lots of things. I tried to add es2016, es2017 into lib part in tsconfig but didnot work.
Also @types/core-js version in package.json is 0.9.39.
"@types/core-js": "^0.9.39",
"@types/lodash": "^4.14.59",
"@types/node": "^6.0.45",
"typescript": "^2.2.2"
Can you help me?
Thanks in advance
I wanted to bundle aot but normal tsconfig file affects aot bundle. So I prepared normal tsconfig file like below, problem solved:
{
"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"
]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.