kaisermann / svelte-loadable

Dynamically load a svelte component
MIT License
320 stars 13 forks source link

no success on first try #24

Closed rbenzazon closed 4 years ago

rbenzazon commented 4 years ago

Hello,

Thanks for contributing with this project. I just tried on a current project to check it out. I was wondering how the rollup build would need to be modified for it to work. It seems that nothing is included in this package to handle the build of individually loaded components. I have some success seeing in the network monitor that my .svelte was loaded, but the browser makes errors when receiving the .svelte file (mime type for instance).

Anyway, why load a .svelte file, it should be packaged and loaded as a packaged module. I'm looking for a solution to reduce the main bundle of my svelte app by making part of the build a separate file but your project seems to handle only a minority of my needs. The documentation is not covering the building part at all, could you clarify the extent of your repo with my case's point of view?

JohnnyFun commented 4 years ago

Take a look at the svelte "realworld" project's rollup to see how to configure the svelte compiler with rollup: https://github.com/sveltejs/realworld/blob/master/rollup.config.js

rbenzazon commented 4 years ago

Thank you for answering, I'll check these right away

kaisermann commented 4 years ago

This package's purpose is to be a way of dynamically loading svelte components on-the-fly. Their bundle is up to the developer. If you use sapper, it abstracts that for you and you only need to care about importing your components as shown on the readme 😁

rbenzazon commented 4 years ago

Thank you for giving me answered, much appreciated

rbenzazon commented 4 years ago

Hi, I finally had the occasion to follow up on that and I discovered that rollup supports code splitting natively, I didn't need this package. This package is useful for some cases I guess but the readme didn't allow me to be sure initially, even on google the resources for code splitting with svelte were not clear and useful. I didn't need sapper as well. Thanks anyway because your answer indirectly helped me find the solution to my problem.