bougarfaoui / ng-socket-io

Socket.IO module for Angular
MIT License
254 stars 57 forks source link

No compilation output #38

Closed ghost closed 6 years ago

ghost commented 6 years ago

(I'm using last version 0.2.0 of ng-socket-io)

Since I update to angular5 and angular-cli 1.5, I have this error when starting my app:

ERROR in ./node_modules/ng-socket-io/socket-io.module.ts Module build failed: Error: /usr/src/app/node_modules/ng-socket-io/socket-io.module.ts is not part of the compilation output. Please check the other error messages for details. at AngularCompilerPlugin.getCompiledFile (/usr/src/app/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:629:23) at plugin.done.then (/usr/src/app/node_modules/@ngtools/webpack/src/loader.js:467:39) at process._tickCallback (internal/process/next_tick.js:109:7) @ ./node_modules/ng-socket-io/index.js 3:25-54 @ ./src/app/app.module.ts @ ./src/main.ts @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts

Daudr commented 6 years ago

ng serve --aot works

derjp commented 6 years ago

Make sure your tsconfig.json file looks like this:

{
  "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/ng-socket-io/index.ts"
  ]
}

Add the index.ts file of ng-socket-io to the includes section of the file, works perfectly

marnixbent commented 6 years ago

At first it wasn't working for me, but then I noticed that I needed to restart the webserver so it compiles completely. Thanks.

derjp commented 6 years ago

The problem with this is that the library is incorrectly packaged. Libraries should never ship their ts files. Here's a very good explanation, I hope you can update the library accordingly as it is really helpful and should be coded properly:

https://github.com/angular/angular-cli/issues/8284#issuecomment-341417325

If this isn't updated properly even the way of including the index.ts file will break in the future. This is absolutely mandatory.

bougarfaoui commented 6 years ago

@Vxrize I published a new version ng-socket-io@0.2.3 as you said, I tested it in JIT and Aot and it works just fine on both Angular and Ionic. Many thanks.

derjp commented 6 years ago

Great, I will test it out!