I have an application in production using React 15 which can't be upgraded to the latest React (16) anytime soon.
For the future I want to use piral as a whole, but piral requires React 16 and I don't see how to use React 15 in a pilet.
How can React 15 be used in a pilet / with piral?
What I was thinking so far: I could just follow the path of piral-preact and include a converter. But I have trouble with this approach. Any recommendation or help?
Generally, you could bundle React 15 / React 15 DOM in a pilet. If multiple pilets are used, you can make React 15 / React 15 DOM a shared dependency. For convenience a converter (e.g., like the one for Inferno) could be created.
Important: To avoid any collisions with the existing react
and react-dom
packages aliases should be used.
In the package.json these aliases can be specified like:
{
// ...
"dependencies": {
"react-15": "npm:react@^15",
"react-dom-15": "npm:react-dom@^15"
}
}
Importing / using them also works with the alias then (e.g., react-15
).
We are right now working on a React 15 converter that you could use out of the box. The current WIP can be seen on the GitHub monorepo.