JulioWar / jw-bootstrap-switch-ng2

Bootstrap Switch for Angular 2+
https://juliowar.github.io/jw-bootstrap-switch-ng2/
MIT License
43 stars 14 forks source link

jw-bootstrap-switch-ng2\dist\directive.ts is not part of the compilation output #19

Closed pinktoadette closed 6 years ago

pinktoadette commented 6 years ago

Keeps throwing me this. I upgraded all my nod_modules, then this appeared. ERROR in ./node_modules/jw-bootstrap-switch-ng2/dist/directive.ts Module build failed: Error: Path\user-app\node_module s\jw-bootstrap-switch-ng2\dist\directive.ts is not part of the compilation output . Please check the other error messages for details. at AngularCompilerPlugin.getCompiledFile (Path\us er-app\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23) at plugin.done.then (Path\user-app\node_modules\@ ngtools\webpack\src\loader.js:467:39) at process._tickCallback (internal/process/next_tick.js:109:7) @ ./node_modules/jw-bootstrap-switch-ng2/dist/index.js 10:18-40 @ ./src/app/app.module.ts @ ./src/main.ts @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts

JulioWar commented 6 years ago

Hello @pinktoadette can you share the version of angular and the version of this library that you are using?

JulioWar commented 6 years ago

Hey guys, Thanks for reporting the issue. I Think is an issue cause by angular version so please give some time to figure it out what is wrong.

Thanks for using my library.

JulioWar commented 6 years ago

Hello @pinktoadette

I think this alternative workaround for now. Try to change the tsconfig.json.

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  },
  "include":[
    "src/**/*",
    "node_modules/jw-bootstrap-switch-ng2/dist/index.ts"
  ]
}

Include the library.

Please let me kwow if that works for you and I will continue working to fix the problem.

pinktoadette commented 6 years ago

It’s working fine now. Thanks!

On Nov 8, 2017, at 8:31 PM, Julio Guerra notifications@github.com wrote:

Hello @pinktoadette

I think this alternative workaround for now. Try to change the tsconfig.json.

{ "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2017", "dom" ] }, "include":[ "src/*/", "node_modules/jw-bootstrap-switch-ng2/dist/index.ts" ] } Include the library.

Please let me kwow if that works for you and I will continue working to fix the problem.

― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

leomayer commented 6 years ago

Does not work here with Angular 5.0.5. Additionally the build fails with enabled option --aot

JulioWar commented 6 years ago

Hello guys, sorry for the delay. I was searching about this and a found these issues that are related:

If some of you found some solution that I can implement will be awesome, I am little bussy right now... but I'm gonna try to solve this issue as soon is possible

bpatrik commented 6 years ago

Hi,

I also did some google and found this comment (in the issue mentioned): https://github.com/angular/angular-cli/issues/8284#issuecomment-341417325

It says that libs should not include .ts files, only compiled ones.

You can check what other libs are doing. These seem to working fine for me: ng2-slim-loading-bar, ng2-toaster

JulioWar commented 6 years ago

Hello @bpatrik, sorry for my delay but this last days I was working on other projects and I didn't test that. Can you please tell what version of nodejs do you have ?

Today I try to install the last version of node js and then I remove the node_module directory and I tried to install all again and for some reason it works.

Can you please try that ?

This is the version of my dependencies:

Angular CLI: 1.5.0
Node: 8.9.3
OS: win32 x64
Angular: 5.1.2

I thinks is releated to the Angular version too

JulioWar commented 6 years ago

But yeah, I'm gonna remove the ts files but I just want to test how it works with in IONIC

bpatrik commented 6 years ago

Hi,

I think the problem appeared with the latest angular cli and it's (mostly) independent from node.

I'm using these:

 "@angular/animations": "^5.1.2",
 "@angular/cli": "1.6.2",
 "@angular/common": "~5.1.2",
 "@angular/compiler": "~5.1.2",
 "@angular/compiler-cli": "^5.1.2",
 "@angular/core": "~5.1.2",
 "@angular/forms": "~5.1.2",
 "@angular/http": "~5.1.2",
 "jw-bootstrap-switch-ng2": "^1.0.8",
 "typescript": "^2.6.2",
node: v6.9.4
npm: 5.6.0
OS: win 10 x64

And I try to compile with this:

ng build -prod

Adding this to tsconfig.app.json soved my problem temporary:

 "include":[
    "./**/*",
    "./../node_modules/jw-bootstrap-switch-ng2/dist/index.ts",
    "./../node_modules/jw-bootstrap-switch-ng2/dist/directive.ts"
  ]

As far as I understand the problem the latest cli does not include all source(.ts) files automatically (which was not a good approach before), but only those that are really source files, so the '.ts' files in the node_modules are excluded by default.

JulioWar commented 6 years ago

@bpatrik I updated the library already, I removed the ts files. Can you try to update the this library and try again ?

bpatrik commented 6 years ago

hmm it seems that it solved the issue partially. for ng build it works, but for ng build -prod, i got an error:

ERROR in : Unexpected value 'JWBootstrapSwitchModule in <projectroot>/node_modules/jw-bootstrap-switch-ng2/dist/index.js' imported by the module 'AppM
odule in <projectroot>/frontend/app/app.module.ts'. Please add a @NgModule annotation.

I'm not sure if this error is still in connection with your library.

JulioWar commented 6 years ago

ok, let me see what can I do

JulioWar commented 6 years ago

Hello Guys, I think I finally did it! Please try to download the last version and try again.

chelaruc commented 6 years ago

Thank you, @JulioWar, for your work! It's working now ❤️ 😍

JulioWar commented 6 years ago

Thanks for the feedback, I'm going to close this issue then.