Side by Side Install

UI Components for React
Post Reply
Devnsyde
Posts: 2
Joined: 21 Apr 2023, 19:39

21 Apr 2023, 19:42

Hello,

We are using a very old version of prime react but it is also all heavily used through out and we cant do an upgrade right now. There is a component Id like to use in your latest version. How can I either use that one component or install the latest version of primereact along side of the old version?

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

23 Apr 2023, 15:03

I am not sure if that is possible to have side by side install. Especially if you are using Create React App or Next.js as the package.json only allows for 1 version.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Devnsyde
Posts: 2
Joined: 21 Apr 2023, 19:39

24 Apr 2023, 16:43

You can alias an install and install side by side but primereact doesn't seem to support that.

for instance, we have primereact 3.1.7 installed, to install the latest version in parallel you would do:

Code: Select all

"primereact_9_3_0": "npm:primereact@^9.3.0",
So I went ahead and did that, i have it installed side by side. I then do my imports:

Code: Select all

import { MultiSelect } from "primereact_9_3_0/multiselect"
And add my component:

Code: Select all

<MultiSelect options={cities} placeholder="Select Cities" onChange={(e) => setSelectedCities(e.value)} />
And I get this error:
./node_modules/primereact_9_3_0/multiselect/multiselect.esm.js
Module not found: Can't resolve 'primereact/api' in 'C:\Dev\App\ClientApp\node_modules\primereact_9_3_0\multiselect'
I think this happens because primereact doesnt refer to itself as this aliased version, it refers to itself as primereact so the new version calls the old version ehich is installed in the package.json as:

Code: Select all

"primereact": "^3.1.7",
Is there anything I could do to get around this?

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests