Skip to content

Commit 1ab937c

Browse files
committed
fix: Updated README
1 parent 5047a1d commit 1ab937c

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
This plugin makes it possible to import SVG files as Svelte
44
components, inline SVG code or urls.
55

6-
_NOTE! This plugin isn't just for SvelteKit, but works for any Svelte
6+
> ### **NOTE!** For **Svelte 4** projects, use version 4 of this plugin
7+
8+
> _NOTE! This plugin isn't just for SvelteKit, but works for any Svelte
79
project using Vite_
810

911
## Install
@@ -192,8 +194,24 @@ interface Options {
192194
}
193195
````
194196

197+
## Typescript
198+
199+
For Typescript not to complain about `file.svg?component` et.al, add the
200+
following import statement to `src/app.d.ts` (or any `.d.ts` file somewhere in the path of your
201+
project where `tsc` can find it).
202+
203+
```ts
204+
import '@poppanator/sveltekit-svg/dist/svg.d.ts'
205+
```
206+
207+
> **NOTE!** If you have `module`/`moduleResolution` set to `NodeNext` in your
208+
> Typescript config, you **MUST** include `.d.ts` in the import of the SVG
209+
> type definition.
210+
195211
## Notes on using with _Jest_
196212

213+
_I don't know if this still applies, but it's kept here for good measure_
214+
197215
According to a report [_Jest_](https://jestjs.io/) will have trouble
198216
transforming `.svg` files when such is imported as a Svelte component.
199217

@@ -213,17 +231,3 @@ module.exports = {
213231
where `src/lib/EmptyIcon.svelte` can contain just `<svg />`.
214232

215233
> [See the reported issue and solution](https://github.com/poppa/sveltekit-svg/issues/22)
216-
217-
## Typescript
218-
219-
For Typescript not to complain about `file.svg?component` et.al, add the
220-
following import statement to `src/app.d.ts` (or any `.d.ts` file somewhere in the path of your
221-
project where `tsc` can find it).
222-
223-
```ts
224-
import '@poppanator/sveltekit-svg/dist/svg.d.ts'
225-
```
226-
227-
> **NOTE!** If you have `module`/`moduleResolution` set to `NodeNext` in your
228-
> Typescript config, you **MUST** include `.d.ts` in the import of the SVG
229-
> type definition.

0 commit comments

Comments
 (0)