svelte-materialify
svelte-materialify copied to clipboard
Could svelte-materialify add a preprocessor like optimize-carbon-imports?
There is a preprocessor for carbon that rewrites the import block so that it is importing by components. It speed up the development server.
Can you tell me exactly what does this do?
Sorry, they have a description section in the README, link here.
Before import { Button, Header } from "carbon-components-svelte"; After import Button from "carbon-components-svelte/Button/Button.svelte"; import Header from "carbon-components-svelte/UIShell/GlobalHeader/Header.svelte";
Svelte materialify is soon to be deprecated, I will try to add this feature in svelterial.
@xhebox maybe my knowledge on this is too low, but rollup should throw away everything unused anyways?
So if we import { Button } from "svelte-materialify/src" it should only include the Button code. If this is not how it currently works, it should still work this way, so it's a bundler issue (well, or I understand something wrong here).
@Florian-Schoenherr
but rollup should throw away everything unused anyways
Yes, you are correct.
The thing is about vite, or snowpack. They, when starting a dev server, will do nothing like tree shaking, to speed up the (re)loading process. They only do all the work when it is for production.
I've got 1 or 2 sec around, when importing the whole bundle of svelte-materialify. When it is production, it is like 100ms or less.