Reputation: 4954
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
I'm trying to upgrade an angular2/beta8 app to RC1, and I'm doing so by basically restructuring according to the Quickstart guide.
I copied its tsconfig.json into my project directory. I think I've got everything else ready,but when I run tsc
, I get all kinds of errors within files in my node_modules folder. Why is it even looking in there in the first place?
Upvotes: 42
Views: 28098
Reputation: 1
i have resolve this issue by npm updating global typescript packge
npm update -g typescript
then you can delete your tsconfig and create a new tsc --init
Upvotes: -2
Reputation: 1043
Add this option in tsconfig.json
{
"compilerOptions": {
"skipLibCheck": true
},
}
Upvotes: 46
Reputation: 2334
For anybody using webpack, adding the "exclude" property did not work for me.
Instead adding all file extensions to the webpack "resolve" property and exclude node_modules from any "rules" objects worked:
resolve: {
extensions: ['*', '.ts', '.tsx', '.js']
},
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: [
{
loader: "ts-loader"
}
]
},
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{
enforce: "pre",
test: /\.js$/,
exclude: /node_modules/,
loader: "source-map-loader"
},
]
Upvotes: 3
Reputation: 8959
I don't know if you found an answer to this Alex but the referred to question/answer in the comments by LDL provides an answer, submitted by Srikanth Injarapu.
Here's the answer just in case someone doesn't feel like going to that link:
If you're targeting ES5, add "node_modules/typescript/lib/lib.es6.d.ts" to tsconfig.json file :
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"outDir": "built",
"rootDir": ".",
"sourceMap": false
},
"files": [
"helloworld.ts",
"node_modules/typescript/lib/lib.es6.d.ts"
],
"exclude": [
"node_modules"
]
}
EDIT
In my application I make use of webpack to build my app and I still get the same errors being spat out on the console. I'm currently looking in to fixing this and will report back with what I find.
Upvotes: 11