KyleJune / deno-tailwind-ui-react-example

An example of how you can use Tailwind UI and React with Deno
20 stars 5 forks source link

Add code splitting with lazy loading #16

Open KyleJune opened 2 years ago

KyleJune commented 2 years ago

https://reactjs.org/docs/code-splitting.html

I think for this, the import paths will need to be relative paths to the bundles for components that are lazy loaded. I'll need to update the make command to make all the bundles along with updating the live reload script to handle it. Might make sense to make a file for registering which tsx files should have bundles generated for them.

KyleJune commented 2 years ago

I'm actually not sure if this would work with deno bundle. I believe each bundle would end up having copies of the dependencies since each component would be depending on components/deps.ts. It wouldn't make sense to do this if it would result in the client downloading the dependencies to the client multiple times.