Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

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

Open
xhebox opened this issue Apr 3, 2021 · 5 comments
Open

Comments

@xhebox
Copy link

xhebox commented Apr 3, 2021

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

@TheComputerM
Copy link
Owner

Can you tell me exactly what does this do?

@xhebox
Copy link
Author

xhebox commented Apr 5, 2021

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

@TheComputerM
Copy link
Owner

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

@Florian-Schoenherr
Copy link
Collaborator

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

@xhebox
Copy link
Author

xhebox commented Apr 6, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants