Ng2-select: App fails to compile when using rootDir in tsconfig

Created on 25 Apr 2016  路  8Comments  路  Source: valor-software/ng2-select

As soon as I import either Select or SELECT_DIRECTIVES I get the following compile errors

error TS6059: File '/node_modules/ng2-select/components/select.ts' is not under 'rootDir' 'src'. 'rootDir' is expected to contain all source files.
error TS6059: File '/node_modules/ng2-select/components/select/select-interfaces.ts' is not under 'rootDir' 'src'. 'rootDir' is expected to contain all source files.
error TS6059: File '/node_modules/ng2-select/components/select/select-item.ts' is not under 'rootDir' 'src'. 'rootDir' is expected to contain all source files.
error TS6059: File '/node_modules/ng2-select/components/select/select-pipes.ts' is not under 'rootDir' 'src'. 'rootDir' is expected to contain all source files.
error TS6059: File '/node_modules/ng2-select/components/select/select.ts' is not under 'rootDir' 'src'. 'rootDir' is expected to contain all source files.

Here is my tsconfig

{
  "compilerOptions": {
    "rootDir": "src",
    "outDir": "build",
    "target": "ES5",
    "module": "system",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  },
  "exclude": [
    "node_modules",
    "typings/browser.d.ts",
    "typings/browser"
  ]
}
  • angular2: 2.0.0-beta.15
  • ng2-select: 1.0.1-beta.0
  • typescript: 1.8.10

Most helpful comment

+1

All 8 comments

+1

+1

This seems to be due to .ts and .d.ts files existing within the same directory and causing the typescript compiler to recompile the module and then getting confused because it is outside of the rootDir.

I found this ng2-bootstrap issue that appears to be the same problem.

I forked the repo and was about to look in to fixing the issue when I noticed this commit, which seems like it may be the fix that I was looking for due to the .npmignore modifications. However I can't test using npm install ng2-select or npm install valor-software/ng2-select, is there an npm release coming up?

check out latest version
no .ts files in npm :)

I can confirm the latest release fixes the issue, thanks!

awesome!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rkralston picture rkralston  路  3Comments

Garybhardwaj picture Garybhardwaj  路  3Comments

jay-perera picture jay-perera  路  6Comments

denghuiquan picture denghuiquan  路  3Comments

jenb34 picture jenb34  路  5Comments