ubeac / svelte

Accelerate your Svelte development with uBeac's powerful and easy-to-use UI components
https://svelte.ubeac.io
MIT License
37 stars 6 forks source link

Optimize references to components #376

Open pournasserian opened 2 years ago

pournasserian commented 2 years ago

If we import a component which is not used, the optimizer should remove the reference to reduce the size of bundle.

import { Button, ButtonGroup } from '@ubeac/svelte'

<Button>Submit</Button>

Should be transformed to:

import { Button } from '@ubeac/svelte'

<Button>Submit</Button>
TheHadiAhmadi commented 2 years ago

What about AutoImport components?

https://github.com/yuanchuan/sveltekit-autoimport

usage:

<Button>
  <Icon name="book"/>
</Button>
pournasserian commented 2 years ago

What about AutoImport components?

https://github.com/yuanchuan/sveltekit-autoimport

usage:

<Button>
  <Icon name="book"/>
</Button>

Does id support intellisense in VSCode?

TheHadiAhmadi commented 2 years ago

There is an open issue in their GitHub page https://github.com/yuanchuan/sveltekit-autoimport/issues/30

And in that issue someone posted a YouTube link which shows how we can use sveltekit-autoimport and how to define component types in global.d.ts file

https://youtu.be/JXvKBtTPr64

declare const Button: typeof import('@ubeac/svelte')['Button'];
declare const Badge: typeof import('@ubeac/svelte')['Badge']
// ....
TheHadiAhmadi commented 2 years ago

There is an open issue in their GitHub page https://github.com/yuanchuan/sveltekit-autoimport/issues/30

And in that issue someone posted a YouTube link which shows how we can use sveltekit-autoimport and how to define component types in global.d.ts file

https://youtu.be/JXvKBtTPr64

declare const Button: typeof import('@ubeac/svelte')['Button']; declare const Badge: typeof import('@ubeac/svelte')['Badge'] // ....

we can do this in index.d.ts file which We created in #383