Hey guys, I am facing following problem:
My Project is built on Angular4 with typescript, e2e testing with protractor & karma. But since a few days I keep getting following error:
File 'D:/myproject/node_modules/protractor/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. (
6054)
File 'D:/myproject/node_modules/q/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. (6054)
File 'D:/myproject/node_modules/selenium-webdriver/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.
d.ts'. (6054)
File 'D:/myproject/node_modules/source-map/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. (
6054)
File 'D:/myproject/node_modules/tapable/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. (605
4)
File 'D:/myproject/node_modules/tslib/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. (6054)
File 'D:/myproject/node_modules/uglify-js/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. (6
054)
File 'D:/myproject/node_modules/webdriver-js-extender/node_modules/selenium-webdriver/package.json' has unsupported extension. The only support
ed extensions are '.ts', '.tsx', '.d.ts'. (6054)
File 'D:/myproject/node_modules/webdriver-js-extender/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx',
'.d.ts'. (6054)
at getOutput (D:\myproject\node_modules\ts-node\src\index.ts:300:15)
at D:\myproject\node_modules\ts-node\src\index.ts:330:16
at Object.compile (D:\myproject\node_modules\ts-node\src\index.ts:489:17)
at Module.m._compile (D:\myproject\node_modules\ts-node\src\index.ts:382:43)
at Module._extensions..js (module.js:580:10)
at Object.require.extensions.(anonymous function) [as .ts] (D:\myproject\node_modules\ts-node\src\index.ts:385:12)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
[23:41:57] E/launcher - Process exited with error code 100
As I understand the error message, the typscript loader tries to transpile non-ts files. For sure I have searched the whole internet before posting my question, and it looks like something with the @types within my tsconfig.json is not working properly.
I have checked the documentation for @types and tsconfig and related issues on github, but I think it's not behaving correctly here. The Docs state that,
only files with supported extensions are included (e.g. .ts, .tsx, and .d.ts by default with .js and .jsx if allowJs is set to true).
Then why is it trying to include all the .json files?
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"importHelpers": true,
"strictNullChecks": false,
"lib": [
"dom",
"es6"
],
"typeRoots": [
"node_modules/@types"
],
"types": [
"hammerjs",
"jasmine",
"node",
"source-map",
"uglify-js",
"webpack"
]
},
"exclude": [
"node_modules",
"dist"
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
Detailed Information about myproject:
node v7.4.0
npm v4.1.2
typescript@2.3.4
protractor@5.1.2
├── src/
│ ├── custom-typings.d.ts
├── node_modules/
│ ├── @types
│ | ├── hammerjs
│ | | ├── index.d.ts
│ | | ├── package.json
│ | | ├── README.md
│ | | ├── types-metadata.json
│ | ├── jasmine
│ | | ├── index.d.ts
│ | | ├── ...
│ | ├── node
│ | | ├── index.d.ts
│ | | ├── ...
│ | ├── source-map
│ | | ├── index.d.ts
│ | | ├── ...
│ | ├── uglify-js
│ | | ├── index.d.ts
│ | | ├── ...
│ | ├── webpack
│ | | ├── index.d.ts
│ | | ├── ...
│ | ├── ...
│ └── (@agm, @angular, ...)
├── package.json
├── glyphicons-halflings-regular.svg
├── glyphicons-halflings-regular.ttf
└── glyphicons-halflings-regular.woff
What I have already tried:
- removing exclude block, as it contains same as default value:
The "exclude" property defaults to excluding the node_modules, bower_components, jspm_packages and directories when not specified.
-
setting option "allowJs: true", resulted in missing loader for files (not an appropriate solution)
-
removing typeRoots to use default settings, resulted in same error
How can I solve this, to load only appropriate .ts files? Thanks in advance for any help!
additional resources:
via dagopert
No comments:
Post a Comment