PrimeReactProvider: Context is not propagated when building PrimeReact in local
Describe the bug
It is a bit annoying (or rather unfeasible) to work in unstyled mode locally since the configuration is not propagated through the PrimeReactContext/PrimeReactProvider. For it to work you have to individually pass the unstyled and pt props to each component. I don't know if this may have a solution, since it seems that when compiling the library locally and the components use const context = React.useContext(PrimeReactContext); they are importing the default context of the library, not the one configured in the project that consumes PrimeReact.
Reproducer
https://stackblitz.com/edit/yy65qv?file=src%2Fmain.jsx
PrimeReact version
10.7.0
React version
18.x
Language
ALL
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
-
Go to reproducer
-
Inspect datatable bodyrow section
-
You will see classname CLASSNAME_TEST applied (This is fine)
-
Download Stackblitz project to local
-
Change package.json
"primereact": "latest"with your local PrimeReact library path"primereact": "C:\\Users\\YOUR_USER\\Desktop\\primereact\\dist" -
Install dependencies again and run project
-
Now if you inspect datatable bodyrow section you will NOT see classname CLASSNAME_TEST
This happens with ALL components.
Expected behavior
Configuration applied in PrimeReactProvider is propagated when building PrimeReact in local environment.