Primeng: Primeng breaks new Angular 9 project

Created on 13 Dec 2019  路  15Comments  路  Source: primefaces/primeng

[x] bug report
[ ] feature request
[ ] support request

Angular version: 9.0.0-rc.6
Primeng version: 9.0.0-rc.2

I created a new Angular 9 project and installed the primeng package with the following command:

yarn add primeng

Primeng has been installed with 9.0.0-rc.2 version. Is it a problem right? Why rc version comes as default?

After, I imported the some modules to AppModule like this:

import { TableModule, ToastModule, CalendarModule } from 'primeng';
@NgModule({
  ...
  imports: [BrowserModule, AppRoutingModule, TableModule, ToastModule, CalendarModule],
  ...

I ran the yarn start聽and I faced an error as shown below:

ERROR in The target entry-point "primeng" has missing dependencies:
 chart.js

I installed the chart.js with following line and then I ran yarn start again.
yarn add chart.js

Then, I faced an error again

ERROR in The target entry-point "primeng" has missing dependencies:
 quill

I installed the quill and then ran the project again.

Occurred an error again.

ERROR in The target entry-point "primeng" has missing dependencies:
 @fullcalendar/core

Installed @fullcalendar/core and that was it. No more error...

Most helpful comment

Hello, @mehmet-erim

I have tested on this version.
Angular version: ~9.0.0-rc.7
Primeng version: ^9.0.0-rc.2

the imports from _"primeng"_ or _"primeng/primeng"_ were deprecated, so, please use like below

import { TableModule } from "primeng/table";
import { ToastModule } from "primeng/toast";
import { CalendarModule } from "primeng/calendar";

All 15 comments

Did you use in your project some charts, calendar or Rich Text Editor ?

Did you use in your project some charts, calendar or Rich Text Editor ?

No, I didn't. It was a new project reproduction.

Hello, @mehmet-erim

I have tested on this version.
Angular version: ~9.0.0-rc.7
Primeng version: ^9.0.0-rc.2

the imports from _"primeng"_ or _"primeng/primeng"_ were deprecated, so, please use like below

import { TableModule } from "primeng/table";
import { ToastModule } from "primeng/toast";
import { CalendarModule } from "primeng/calendar";

Thanks @jackoliveira

what about this message?

ERROR in The target entry-point "primeng" has missing dependencies:

  • @fullcalendar/core

we not ussing fullcalendar module/component.

How can we solve it?

I think it feels a bit dirty to include things you do not use. But the dependencies are actually mentioned here: https://primefaces.org/primeng/#/setup

It seems this error occurs during the Ivy compatibility compiler phase (ngcc).
Ngcc pre-compile all the entry points of primeng and complains about missing dependencies of each one:

  • primeng/chart
  • primeng/fullcalendar
  • primeng/editor
Compiling primeng/chart : es2015 as esm2015
Compiling primeng/fullcalendar : es2015 as esm2015
Compiling primeng/editor : es2015 as esm2015
Compiling primeng : es2015 as esm2015

npm install chart.js --save

How do I make WebStorm use long paths? and the automatic imports lead to this error!

How do I make WebStorm use long paths? and the automatic imports lead to this error!

this might do it:
forbid_import

I got the same error. And I found
import {SelectItem} from 'primeng';
in my code. The problem is "from 'primeng';". The correct code should be "from 'primeng/api'".
I found this is coursed by my Webstorm auto import...
image

@Naono Did you find solution for this bug ?

@Azemoten I don't know, there is nothing need to import from 'primeng', and we should think primeng is a folder, every module is a standalone plug-in, it's good for improving packaging performance and just need to install one package. but the IDEs follow the export structure and find the shortest.

@x3igh7's answer is almost correct, to force IntelliJ/WebStorm to ban import { xxx } from 'primeng', you should go to "File | Settings | Editor | Code Style | TypeScript" and add primeng,primeng/public_api to the "Do not import exactly from" list.

Now automatic imports will be like import {TableModule} from "primeng/table";

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cyberrranger picture cyberrranger  路  3Comments

miresk picture miresk  路  3Comments

jisqaqov picture jisqaqov  路  3Comments

pchristou picture pchristou  路  3Comments

philly-vanilly picture philly-vanilly  路  3Comments