ng2-datetime icon indicating copy to clipboard operation
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

Open tauqeer81 opened this issue 7 years ago • 9 comments

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?

tauqeer81 avatar Nov 10 '17 12:11 tauqeer81

Same problem here

tobiashoeft avatar Nov 10 '17 17:11 tobiashoeft

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

  1. tried to include ./node_modules/ng2-datetime/ng2-datetime.ts in my tsconfig.app.json, so that it is available during the compilation process
  2. 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.

vikasverma93 avatar Nov 10 '17 18:11 vikasverma93

Thank you vikasverma92. With your help, I was able to get this to work.

Darth-Vader-2020 avatar Nov 30 '17 15:11 Darth-Vader-2020

@tauqeer81 Were you able to make it work? I will try to setup the demo project with angular cli for the next version

nkalinov avatar Jan 02 '18 16:01 nkalinov

don't work

enigmatik avatar Jan 11 '18 08:01 enigmatik

None of these options, nor anything else I've tried as made this ng5 compatible for me during karma tests

bculley avatar Feb 07 '18 21:02 bculley

This issue occurs for me when using TS v2.6.x but not with TS v2.5.x.

OskarKlintrot avatar Mar 12 '18 12:03 OskarKlintrot

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"
  ]
}

OskarKlintrot avatar Mar 12 '18 14:03 OskarKlintrot

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)

simg avatar Mar 13 '18 14:03 simg