Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular 19 Support #16827

Closed
mertsincan opened this issue Nov 22, 2024 · 46 comments
Closed

Angular 19 Support #16827

mertsincan opened this issue Nov 22, 2024 · 46 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@mertsincan
Copy link
Member

Details; #16783

@mertsincan mertsincan pinned this issue Nov 22, 2024
@mertsincan mertsincan added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Nov 22, 2024
@mertsincan mertsincan added this to the 18.0.0-rc.2 milestone Nov 22, 2024
@mertsincan mertsincan moved this to Review in PrimeNG Nov 22, 2024
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 22, 2024
@mertsincan mertsincan removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 22, 2024
@AStoker
Copy link

AStoker commented Nov 22, 2024

If it helps, here's a list of files that needed to be updated in my testing. The Docs still have a lot of work though. AStoker@a1bad87

mertsincan added a commit that referenced this issue Nov 25, 2024
@github-project-automation github-project-automation bot moved this from Review to Done in PrimeNG Nov 25, 2024
@mertsincan mertsincan reopened this Nov 25, 2024
@mertsincan mertsincan moved this from Done to In Progress in PrimeNG Nov 25, 2024
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 25, 2024
@mertsincan mertsincan added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add and removed Status: Pending Review Issue or pull request is being reviewed by Core Team Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 25, 2024
@NateRadebaugh
Copy link

Can this be back-ported to a 17.x release once this is ready?

@mertsincan
Copy link
Member Author

Today, we had a detailed meeting about Angular 19 and decided to support it with PrimeNG 19. We are very close to the PrimeNG 18.Final. After releasing it, we plan to release PrimeNG 19.rc.1 within 1 to 2 weeks. Thanks a lot for your understanding!

@mertsincan
Copy link
Member Author

Can this be back-ported to a 17.x release once this is ready?

Unfortunately, we do not plan to port it to version 17. Primeng versions will be released following the Angular versions. Otherwise, there will be many breakages in frameworks and libraries that are under such active development. I think this is the most logical thing.

@mertsincan mertsincan modified the milestones: 18.0.0-rc.2, 19.x Nov 25, 2024
@mertsincan mertsincan removed this from PrimeNG Nov 25, 2024
@radarsu
Copy link
Contributor

radarsu commented Dec 8, 2024

For people interested with a dirty, temporary workaround, Angular 19 works with Primeng 18, if after installing dependencies you do:

  1. Kill angular app.
  2. Delete angular cache.
  3. Run find ./node_modules/primeng/fesm2022 -type f -name "*.mjs" -exec sed -i 's/, i0\.ɵɵStandaloneFeature],/],/g' {} +
  4. Enjoy.

Above could as well be added in package.json postinstall script for convenience:

"scripts": {
    "postinstall": "find ./node_modules/primeng/fesm2022 -type f -name \"*.mjs\" -exec sed -i 's/, i0\\.ɵɵStandaloneFeature],/],/g' {} +"
},

@robmanganelly
Copy link

MAC folks using @radarsu 's script 👀

"postinstall": "find ./node_modules/primeng/fesm2022 -type f -name \"*.mjs\" -exec sed -i '' 's/, i0\\.ɵɵStandaloneFeature],/],/g' {} +"

@JakeAi
Copy link

JakeAi commented Dec 9, 2024

For people interested with a dirty, temporary workaround, Angular 19 works with Primeng 18, if after installing dependencies you do:

  1. Kill angular app.
  2. Delete angular cache.
  3. Run find ./node_modules/primeng/fesm2022 -type f -name "*.mjs" -exec sed -i 's/, i0\.ɵɵStandaloneFeature],/],/g' {} +
  4. Enjoy.

Above could as well be added in package.json postinstall script for convenience:

"scripts": {
    "postinstall": "find ./node_modules/primeng/fesm2022 -type f -name \"*.mjs\" -exec sed -i 's/, i0\\.ɵɵStandaloneFeature],/],/g' {} +"
},

Thanks for this. Have you noticed any side effects?

@radarsu
Copy link
Contributor

radarsu commented Dec 9, 2024

@JakeAi
Haven't, so far it works like a charm for me.

@JakeAi
Copy link

JakeAi commented Dec 9, 2024

@JakeAi Haven't, so far it works like a charm for me.

I'm working on a new project using angular 18, but the new signal functionality is a must have. I feel by the time I'm "done," I'd have to refactor to v19. I haven't noticed anything yet either.

@radarsu
Copy link
Contributor

radarsu commented Dec 9, 2024

@JakeAi yeah, the signals make whole codebase so much more managable. I'd recommend mastering them quickly and Angular 19 release is crazy good, so on new project you might want to consider upgrading quickly.

I do a project with Angular 19 fully based on signals, primeng 18 and tailwind v4 beta. Figuring out perfect setup was tough, but those new releases solve so many problems I was struggling with in the past it's worth it (state management with signals feels so much better, management of primitive and semantic CSS values and components, theming and light/dark modes).

I even uninstalled zone.js and did zoneless angular and everything is working great, I no longer have obscured stack traces.

Feel free to contact me privately if you'd like to copy my setup.

@imaksp
Copy link

imaksp commented Dec 10, 2024

Hi @radarsu zoneless is working with primeng v18?, AFAIK zoneless is not supported by this lib yet.

@radarsu
Copy link
Contributor

radarsu commented Dec 10, 2024

@imaksp
Haven't yet encountered any problems without it. I use OnPush changeDetection strategy and manage data via signals everywhere. But so far I use just few simple components from PrimeNG in that setup, maybe some advanced ones will have problems.

@Odex64
Copy link

Odex64 commented Dec 10, 2024

@radarsu Hey, how did you manage to install Tailwind v4? I get a bunch of errors while attempting to install that in a clean Angular v19 project.

@radarsu
Copy link
Contributor

radarsu commented Dec 10, 2024

@Odex64
I started with:

  1. pnpm i -D tailwindcss@next @tailwindcss/postcss@next
  2. I created postcss.config.json in root of project:
{
    "plugins": {
        "@tailwindcss/postcss": {}
    }
}
  1. I added theme.css file in src/styles:
@import 'tailwindcss';

@theme {
    --color-*: initial;
    --font-*: initial;
   /* ... */
    --color-primary-500: var(--p-primary-500);
    --color-error-500: var(--p-error-500);
}
  1. I imported theme.css file in my index.scss that's loaded by angular.json.
@use './primeng.scss' as *;
@use './components.scss' as *;
@use './utilities.scss' as *;
@import './theme.css';

Major nuances I experienced were:

  1. It didn't work when I tried using another format than postcss.config.json (I believe I've tried js and mjs).
  2. It didn't work when I used tailwind @theme in .scss file, so I had to keep tailwind configuration in .css.
  3. It didn't work when I used @use './theme.css' as *; instead of @import './theme.css';.

@slawanextlevels
Copy link

Im still getting also with the postinstall


Uncaught TypeError: fn is not a function
    at core.mjs:19413:38
    at Array.forEach (<anonymous>)
    at initFeatures (core.mjs:19413:24)
    at Object.toString (core.mjs:19275:5)
    at noSideEffects (core.mjs:122:5)
    at ɵɵdefineComponent (core.mjs:19240:10)
    at <static_initializer> (primeng-menu.mjs:720:33)
    at primeng-menu.mjs:703:1

@radarsu
Copy link
Contributor

radarsu commented Dec 10, 2024

@slawanextlevels make sure you have killed an angular app then cleaned angular cache directory, then run script and error should be gone.

@mertsincan
Copy link
Member Author

Hi everyone,

Thank you so much for the PRs and feedback! PrimeNG 19 now works with Angular 19. Today, we plan to release PrimeNG 19-rc.1 so you can test it and share your thoughts.
master...v19

I’d also like to talk about what’s next for PrimeNG 20. In v18 and v19, our main focus was building the new theming engine, and now it’s complete. For PrimeNG 20, we want to improve the codebase completely. This includes using strict types, adding more tests, moving to a signal-based and zoneless structure, and updating all components with the latest best Angular practices. We have a lot of internal improvements planned and will share more details with you soon.

@yarikwest
Copy link

Hi everyone,

Thank you so much for the PRs and feedback! PrimeNG 19 now works with Angular 19. Today, we plan to release PrimeNG 19-rc.1 so you can test it and share your thoughts. master...v19

I’d also like to talk about what’s next for PrimeNG 20. In v18 and v19, our main focus was building the new theming engine, and now it’s complete. For PrimeNG 20, we want to improve the codebase completely. This includes using strict types, adding more tests, moving to a signal-based and zoneless structure, and updating all components with the latest best Angular practices. We have a lot of internal improvements planned and will share more details with you soon.

When is the planned final release of v19?

@mertsincan
Copy link
Member Author

mertsincan commented Dec 10, 2024

When is the planned final release of v19?

Unless there are any major issues, we plan to release PrimeNG v19.Final the next week.

@slawanextlevels
Copy link

I got master...v19 running. Thank you

@mertsincan
Copy link
Member Author

PrimeNG 19.0.0-rc.1 Released; https://www.npmjs.com/package/primeng/v/19.0.0-rc.1

@dalenguyen
Copy link
Contributor

Confirmed that 19.0.0-rc.1 fixed the Uncaught TypeError: fn is not a function issue on my end :)

@gbarrionuevo
Copy link

#17005

@dragsense
Copy link

PrimeNG 19.0.0-rc.1 working fine with angular 19

@alvaroaxo
Copy link

Confirmed, PrimeNG 19rc works with Angular 19

@lalo-mx
Copy link

lalo-mx commented Dec 13, 2024

I have an issue with 19rc, how are the styles configured now?

@import "primeng/resources/themes/fluent-light/theme.css";
X [ERROR] Could not resolve "primeng/resources/themes/fluent-light/theme.css"

    src/primeng.scss:1:8:
      1 │ @import "primeng/resources/themes/fluent-light/theme.css";
        ╵         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The path "./resources/themes/fluent-light/theme.css" is not exported by package "primeng":

    node_modules/primeng/package.json:46:13:
      46 │   "exports": {
         ╵              ^

@Delagen
Copy link

Delagen commented Dec 13, 2024

@lalo-mx RTFM, migration guide is published https://primeng.org/guides/migration

@dragsense
Copy link

I have an issue with 19rc, how are the styles configured now?

@import "primeng/resources/themes/fluent-light/theme.css";
X [ERROR] Could not resolve "primeng/resources/themes/fluent-light/theme.css"

    src/primeng.scss:1:8:
      1 │ @import "primeng/resources/themes/fluent-light/theme.css";
        ╵         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The path "./resources/themes/fluent-light/theme.css" is not exported by package "primeng":

    node_modules/primeng/package.json:46:13:
      46 │   "exports": {
         ╵              ^

no need to import the css files.

https://primeng.org/theming

Configuration API
Theme
The theme property is used to customize the initial theme.

import { ApplicationConfig } from '@angular/core';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { providePrimeNG } from 'primeng/config';
import Aura from '@primeng/themes/aura';

export const appConfig: ApplicationConfig = {
providers: [
provideAnimationsAsync(),
providePrimeNG({
theme: {
preset: Aura
}
})
]
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.