bonjurmrfirst / ng4-files

20 stars 15 forks source link

Angular5 support: Remove Angular4 dependencies #15

Open mjurczyk opened 6 years ago

mjurczyk commented 6 years ago

All dependencies of this module are, in fact, just devDependencies - and unnecessarily limit angular version to 4.x.x.

Moving all dependencies to devDependencies adds additional Angular 5 support.

Solves #11 Solves #12

bascoder commented 6 years ago

Thanks for the fix @mjurczyk I've included your branch into my Angular 5 app.

However it would fail to compile with the following error:

ERROR in ./node_modules/angular4-files-upload/index.ts
Module build failed: Error: /Users/my_user/projects/my_app/Code/CMS/node_modules/angular4-files-upload/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
    at AngularCompilerPlugin.getCompiledFile (/Users/my_user/projects/my_app/Code/CMS/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:656:23)
    at plugin.done.then (/Users/my_user/projects/my_app/Code/CMS/node_modules/@ngtools/webpack/src/loader.js:467:39)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
 @ ./src/app/app.module.ts 34:30-62
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts

I had to add the following lines to my tsconfig.json to have it to compile successfully:

"include": [
    "node_modules/angular4-files-upload/**/*.ts",
    "**/*.ts"
  ],
 "exclude": [
    "**/*.ignore/*",
    "**/*.spec.ts"
  ]

There is one caveat; it still tries to compile *.spec.ts files and outputs the following errors:

ERROR in node_modules/angular4-files-upload/src/app/ng4-files/components/ng4-files-click/ng4-files-click.component.spec.ts(3,1): error TS2304: Cannot find name 'describe'.
node_modules/angular4-files-upload/src/app/ng4-files/components/ng4-files-click/ng4-files-click.component.spec.ts(11,20): error TS2304: Cannot find name 'jasmine'.
// and many more similar errors

Fortunately, it compiles and builds successfully.

Do you have any idea how I can prevent it to try to compile those spec files?