ng2-datetime
ng2-datetime copied to clipboard
Error on ng serve with angular-cli 1.5.0 and angular version 5.0.1. ng2-datetime.ts is not part of the compilation output
I'm getting this error after upgrading my app to angular version 5.0.1 and angular-cli to 1.5.0
ERROR in ./node_modules/ng2-datetime/ng2-datetime.ts Module build failed: Error: /node_modules/ng2-datetime/ng2-datetime.ts is not part of the compilation output. Please check the other error messages for details. at AngularCompilerPlugin.getCompiledFile (/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:629:23) at plugin.done.then (/home/tauqeer/www/itsrelevant/ir_angular/node_modules/@ngtools/webpack/src/loader.js:467:39) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7) @ ./src/app/routes/routes.module.ts 29:0-61 @ ./src/app/app.module.ts @ ./src/main.ts @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
any help?
Same problem here
Hi, after some research I got my project working. Please note that my project was generated using angular-cli version 1.5.0 So, basically with angular 5, they have changed which TS files would be compiled.
One of these solutions might work for you
- tried to include
./node_modules/ng2-datetime/ng2-datetime.ts
in my tsconfig.app.json, so that it is available during the compilation process - Instead of compiling ng2-datetime.ts in your project with current version of [email protected]; you should import from the compiled module, like this
import {NKDatetimeModule} from 'ng2-datetime/ng2-datetime.js';
Additionally you might get addition error like jQuery is not defined, which can be fixed by including jquery type in compiledOptions of you tsconfig.app.json
So, your tsconfig.app.json would look like this
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "./",
"types": [
"jquery"
],
"allowSyntheticDefaultImports": true
},
"include": [
"**/*.ts",
"../node_modules/ng2-datetime/ng2-datetime.ts"
],
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
Let me know if you still face any issues. Thanks.
Thank you vikasverma92. With your help, I was able to get this to work.
@tauqeer81 Were you able to make it work? I will try to setup the demo project with angular cli for the next version
don't work
None of these options, nor anything else I've tried as made this ng5 compatible for me during karma tests
This issue occurs for me when using TS v2.6.x but not with TS v2.5.x.
I needed to add the last two files below to tsconfig
:
{
"include": [
"**/*.ts",
"../../node_modules/ng2-datetime/ng2-datetime.ts",
"../../node_modules/ng2-datetime/src/ng2-datetime/ng2-datetime.ts",
"../../node_modules/ng2-datetime/src/ng2-datetime/ng2-datetime.module.ts"
]
}
None of the above solutions worked for me. What did work was switching to this fork of ng2-datetime.
https://www.npmjs.com/package/ngx-datetime (sorry nkalinov)