JavadRasouli / ng2-permission

permission based access control for your angular2 applications.
MIT License
53 stars 19 forks source link

App fails to compile when using rootDir in tsconfig #6

Open humbertosales opened 7 years ago

humbertosales commented 7 years ago

I am using the library ng2-permission in my project. My project is a authentication library created for generator-angular2-library...

Unfortunately the ng2-permission was publish with .ts files...

The problem is that the NPM package contains *.ts files. 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.

Can you publish one version without src?

ERROR:

Error File '/opt/projeto/node_modules/angular2-permission/index.ts' is not under 'rootDir' '/opt/projeto/.tmp'. 'rootDir' is expected to contain all source files.
Error File '/opt/projeto/node_modules/angular2-permission/src/directives/except-permission.directive.ts' is not under 'rootDir' '/opt/projeto/.tmp'. 'rootDir' is expected to contain all source files.
Error File '/opt/projeto/node_modules/angular2-permission/src/directives/has-permission.directive.ts' is not under 'rootDir' '/opt/projeto/.tmp'. 'rootDir' is expected to contain all source files.
Error File '/opt/projeto/node_modules/angular2-permission/src/index.ts' is not under 'rootDir' '/opt/projeto/.tmp'. 'rootDir' is expected to contain all source files.
Error File '/opt/projeto/node_modules/angular2-permission/src/model/permission-guard.model.ts' is not under 'rootDir' '/opt/projeto/.tmp'. 'rootDir' is expected to contain all source files.
Error File '/opt/projeto/node_modules/angular2-permission/src/module/ng2-permission.module.ts' is not under 'rootDir' '/opt/projeto/.tmp'. 'rootDir' is expected to contain all source files.
Error File '/opt/projeto/node_modules/angular2-permission/src/services/permission-helper.service.ts' is not under 'rootDir' '/opt/projeto/.tmp'. 'rootDir' is expected to contain all source files.
Error File '/opt/projeto/node_modules/angular2-permission/src/services/permission.guard.ts' is not under 'rootDir' '/opt/projeto/.tmp'. 'rootDir' is expected to contain all source files.
Error File '/opt/projeto/node_modules/angular2-permission/src/services/permission.service.ts' is not under 'rootDir' '/opt/projeto/.tmp'. 'rootDir' is expected to contain all source files.
[19:21:35] 'ngc' errored after 7.28 s
[19:21:35] Error: ngc compilation failed
    at ngc.then (/opt/projeto/gulpfile.js:59:15)

tsconfig:

{
  "compilerOptions": {
    "compileOnSave": false,
    "declaration": true,
    "module": "es2015",
    "target": "es5",
    "baseUrl": ".",
    "stripInternal": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "rootDir": ".",
    "outDir": "../build",
    "lib": [
      "es2016",
      "dom"
    ],        
    "skipLibCheck": true,
    "types": []
  },
  "angularCompilerOptions": {
    "annotateForClosureCompiler": true,
    "strictMetadataEmit": true,
    "skipTemplateCodegen": true,
    "flatModuleOutFile": "my-login.js",
    "flatModuleId": "my-login"
  },
  "files": [
    "./index.ts"
  ]
}
JavadRasouli commented 7 years ago

you can concat *.js files in dist folder and use them.