theKashey / use-sidecar

Another way to code splitting
MIT License
104 stars 9 forks source link

Running on Cloudflare edge #14

Open nenros opened 10 months ago

nenros commented 10 months ago

Mantine somehow use that library as dependency and I have problem with running that on edge runtime. I get

./node_modules/use-sidecar/dist/es2015/renderProp.js
Attempted import error: 'useRef' is not exported from 'react' (imported as 'React').

./node_modules/use-sidecar/dist/es2015/renderProp.js
Attempted import error: 'useState' is not exported from 'react' (imported as 'useState').

./node_modules/use-sidecar/dist/es2015/hook.js
Attempted import error: 'useEffect' is not exported from 'react' (imported as 'useEffect').

I don't get where is problem.

theKashey commented 10 months ago

What is react here? How so these functions are not exists? Cloudflare is not related here as the error is build time, not run time.

nenros commented 10 months ago

https://github.com/nenros/jubilant-bassoon here it is example. You can check that removing that runtime fix error https://github.com/nenros/jubilant-bassoon/blob/master/app/layout.tsx#L7