Skip to content

Commit

Permalink
fix!: make module work on nuxt 3.4.3 (#103)
Browse files Browse the repository at this point in the history
fix!: make module work on nuxt 3.4.3

BREAKING CHANGE:
* removed `simpleAutoImport` option
* changed `defaultImport`'s default value to `componentext`
* added a default config for svgo

see README for more information on migrating to v3
  • Loading branch information
jd1378 authored Apr 29, 2023
1 parent 89cef67 commit 7b125c7
Show file tree
Hide file tree
Showing 20 changed files with 661 additions and 446 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,36 @@ If you were using the `nuxt-icon` component before, you have to change your code
<svgo-special-home filled />
```

## Migrating from v2.x to v3.x

v3 now uses an opinionated default config for svgo by default, to make it work like before simply pass `{}` to `svgoConfig` option:

```ts
export default defineNuxtConfig({
// ...
svgo: {
svgoConfig: {}
}
})
```

also since v3 `simpleAutoImport` option is removed and `defaultImport` is changed to `componentext`. if you were using the following code, and relying on the `defaultImport`, change it:

```vue
<template>
<div>
<IconHome class="w-5 h-5" />
</div>
</template>
<script setup lang="ts">
// change this:
import IconHome from '~/assets/icon-home.svg'
// to this:
import IconHome from '~/assets/icon-home.svg?component'
</script>
```

## Development

- Run `pnpm dev:prepare` to generate type stubs.
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-svgo",
"version": "2.0.1",
"version": "3.0.0",
"packageManager": "[email protected]",
"description": "Nuxt module to load optimized SVG files as Vue components",
"keywords": [
Expand Down Expand Up @@ -58,7 +58,7 @@
"cross-env": "^7.0.3",
"eslint": "latest",
"husky": "8.0.3",
"nuxt": "3.3.3",
"nuxt": "3.4.3",
"pnpm": "8.3.1",
"prettier": "2.8.8",
"semantic-release": "^19.0.5",
Expand All @@ -72,8 +72,7 @@
"pnpm": {
"overrides": {
"json5@<1.0.2": ">=1.0.2",
"nth-check@<2.0.1": ">=2.0.1",
"vite": "^4.3.0-beta.5"
"nth-check@<2.0.1": ">=2.0.1"
}
}
}
Loading

0 comments on commit 7b125c7

Please sign in to comment.