svelte-materialify icon indicating copy to clipboard operation
svelte-materialify copied to clipboard

Could svelte-materialify add a preprocessor like optimize-carbon-imports?

Open xhebox opened this issue 4 years ago • 5 comments

There is a preprocessor for carbon that rewrites the import block so that it is importing by components. It speed up the development server.

xhebox avatar Apr 03 '21 15:04 xhebox

Can you tell me exactly what does this do?

TheComputerM avatar Apr 05 '21 06:04 TheComputerM

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";

xhebox avatar Apr 05 '21 06:04 xhebox

Svelte materialify is soon to be deprecated, I will try to add this feature in svelterial.

TheComputerM avatar Apr 05 '21 11:04 TheComputerM

@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 avatar Apr 06 '21 08:04 Florian-Schoenherr

@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.

xhebox avatar Apr 06 '21 08:04 xhebox