parcel icon indicating copy to clipboard operation
parcel copied to clipboard

Can't do nested lazy import in react

Open dioptre opened this issue 2 years ago β€’ 3 comments

πŸ› bug report

I cant do something like:

const Documentation = lazy(() => import('./components/Documentation'));

then inside Documentation do:

const Chapter1 = lazy(() => import('./components/Chapter1'));

πŸ€” Expected Behavior

Should work

😯 Current Behavior

Errors out.

πŸ’ Possible Solution

Hacky workaround is to use an import, stops the code splitting from working though.

πŸ”¦ Context

I want to use a nested route with a large site.

πŸ’» Code Sample

as above

🌍 Your Environment

Software Version(s)
Parcel 2.6.2
Node 17.1
npm/Yarn 3.2.1
Operating System Mac

dioptre avatar Jun 28 '22 18:06 dioptre

Please provide a reproduction. And also just saying "Errors out." without the actual error message isn't very helpful

mischnic avatar Jun 30 '22 07:06 mischnic

@mischnic do you use an online debugger for cases like this? I’m happy to replicate on a sandbox tool. Just so trivial to replicate I thought you would manage. But guess you guys must be swamped atm.

dioptre avatar Jul 11 '22 17:07 dioptre

I haven't tried it yet, but TBH it's rather often some small (unrelated) detail that triggers a reported bug.

And if you post the error, we can sometimes make educated guesses without even debugging it locally

Always swamped πŸ˜ΆπŸ˜„

mischnic avatar Jul 11 '22 18:07 mischnic