mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 19:46:36 +00:00
docs: add note on using optimizeImports
with svelte-preprocess
Closes #1500
This commit is contained in:
parent
affeb2e2f4
commit
69cee48875
1 changed files with 16 additions and 1 deletions
17
README.md
17
README.md
|
@ -200,7 +200,7 @@ The preprocessor optimizes imports from the following packages:
|
|||
- [carbon-icons-svelte](https://github.com/carbon-design-system/carbon-icons-svelte)
|
||||
- [carbon-pictograms-svelte](https://github.com/carbon-design-system/carbon-pictograms-svelte)
|
||||
|
||||
**Example**
|
||||
**Before & After**
|
||||
|
||||
```diff
|
||||
- import { Button } from "carbon-components-svelte";
|
||||
|
@ -222,6 +222,21 @@ export default {
|
|||
};
|
||||
```
|
||||
|
||||
`svelte-preprocess` should be invoked before any preprocessor from `carbon-preprocess-svelte`.
|
||||
|
||||
```diff
|
||||
// svelte.config.js
|
||||
+ import sveltePreprocess from "svelte-preprocess";
|
||||
import { optimizeImports } from "carbon-preprocess-svelte";
|
||||
|
||||
export default {
|
||||
preprocess: [
|
||||
+ sveltePreprocess(),
|
||||
optimizeImports()
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
- [examples/rollup](examples/rollup/)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue