primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Make @angular/cdk a peer dependency

Open aszechlicki opened this issue 7 years ago • 20 comments

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior compilation error in production build with AOT: ERROR in primeng\components\multiselect\multiselect.ts(782,41): Error during template compile of 'MultiSelectModule' Could not resolve @angular/cdk/scrolling relative to [object Object]..

Expected behavior Successful compilation

Minimal reproduction of the problem with instructions

  • install PrimeNg 7.0.1
  • run ng build --prod

What is the motivation / use case for changing the behavior? I am unable to build and deploy application

Please tell us about your environment: Windows 10, npm

  • Angular version: 7.1.3

  • PrimeNG version: 7.0.1

  • Browser: Irrelevant

  • Language: TypeScript 3.1.6

  • Node (for AoT issues): node --version =
    v10.13.0

aszechlicki avatar Dec 13 '18 14:12 aszechlicki

Same with 7.0.0 and angular 7.1.2 Looks like @angular/cdk no longer compatible with version PrimeNG uses

TiGGeRTSK avatar Dec 13 '18 17:12 TiGGeRTSK

are you sure this is the same reason? PrimeNg 7.0.0 works fine with Angular 7.1.3 for me

aszechlicki avatar Dec 13 '18 17:12 aszechlicki

same problem

7.0.0 build 7.0.1 don't build

ERROR in ../primeng/components/multiselect/multiselect.ts(782,41): Error during template compile of 'MultiSelectModule' Could not resolve @angular/cdk/scrolling relative to [object Object]..

show https://github.com/primefaces/primeng/issues/3952

cyberrranger avatar Dec 13 '18 17:12 cyberrranger

have you installed @angular/cdk ? i simply npm install @angular/cdk and it worked

huineng avatar Dec 13 '18 20:12 huineng

thx is working with @angular/cdk ;)

cyberrranger avatar Dec 13 '18 21:12 cyberrranger

@huineng @angular/cdk is the Material library, I don't think it should be necessary to install one component library to use another.

tiagodws avatar Dec 14 '18 09:12 tiagodws

Well it has been added to prime ?

import { ScrollingModule } from '@angular/cdk/scrolling';

and it's in prime's package json as a dev dependency

huineng avatar Dec 14 '18 09:12 huineng

@huineng Yes, but a devDependency should be only for development/build, not to be used directly on the source code.

On that case, it should be a peerDependency, but again, I find it awkward to install 2 component libraries. Maybe it's just me, thought.

tiagodws avatar Dec 14 '18 10:12 tiagodws

@huineng Yes, but a devDependency should be only for development/build, not to be used directly on the source code.

On that case, it should be a peerDependency, but again, I find it awkward to install 2 component libraries. Maybe it's just me, thought.

Totally agree, it is a peerDependency. Anyway they are very dependent on VirtualScroller from @angular/cdk https://github.com/primefaces/primeng/commit/e8d30f6e614692c1fa8c11ed5a80f8c2a9eef98a

jmesa-sistel avatar Dec 14 '18 13:12 jmesa-sistel

MultiSelect Virtual Scrolling and p-VirtualScroller depends on @angular/cdk so it is not set to peerDependency to avoid issues like this.

cagataycivici avatar Dec 14 '18 19:12 cagataycivici

Need to think more, only two components use it but when added a peer dependency, npm says cdk is required. Maybe we can just document it.

cagataycivici avatar Dec 14 '18 19:12 cagataycivici

Why not add @angular/cdk as a normal dependency ? If it's required by primeng, just using npm i primeng should install all the necessary dependencies, no ?

(btw, using @angular/cdk is a good idea and should be extended to others component, like Dialog for example)

mselerin avatar Dec 19 '18 14:12 mselerin

@mselerin As a normal dependency, if the user's project already has a dependency to another version of @angular/cdk, it would end up with 2 installations of the same library.

As a peerDependency, that doesn't happen. Npm will give a warning if the dependency is not installed, thought.

tiagodws avatar Dec 20 '18 09:12 tiagodws

Commented here: https://github.com/primefaces/primeng/commit/03e6546ab67d7cd045c45c612aad7ae44b77ae91

This is still an issue.

wolves avatar Jan 09 '19 16:01 wolves

Commented here: 03e6546

This is still an issue.

Same here 🚀

rafalschmidt97 avatar Jan 26 '19 18:01 rafalschmidt97

I ran into this issue on 7.0.5

justinasmussen avatar Jan 30 '19 06:01 justinasmussen

So adding the @angular/cdk inside devDependencies and peerDependencies should fix the problem, isn't it ?

mselerin avatar Jan 30 '19 08:01 mselerin

@mselerin A devDependency wouldn't make a difference, except for those developing primeng. Only as a peerDependency would be the right call.

tiagodws avatar Jan 30 '19 15:01 tiagodws

@tiagodws That's why I suggest both : as a devDependency for the developers/contributors of primeng and as a peer for the consumers.

mselerin avatar Jan 30 '19 19:01 mselerin

Solved with npm install --save @angular/cdk

leonetosoft avatar Feb 27 '19 06:02 leonetosoft