Open mrleblanc101 opened 1 year ago
@mrleblanc101 does this work properly if you switch the files into plain JS?
The Nuxt config ? I would guess not since it wouldn't do any type check. Haven't tried tho
The Nuxt config ? I would guess not since it wouldn't do any type check. Haven't tried tho
I mean does the app and the plug-in work properly if you remove types / switch to JS instead of TS files.
(I suspect they don't, somethings wrong with your svgoConfig, I'd recheck the structure.)
The plugin work in both TS and JS mode, even with the type error. I'm a TypeScript beginner, but I think I found a way to make it work, but it requires me to install svgo as a devDependency in my project and I'm not sure its the correct solution:
import svgoConfig from './svgo.config.js';
import type { Config } from 'svgo';
export default defineNuxtConfig({
vite: {
plugins: [
ViteSvgLoader({
svgoConfig: svgoConfig as Config,
defaultImport: 'url',
}),
],
},
});
Otherwise, I can just write the config in the nuxt.config.js
directly and I have no error:
import svgoConfig from './svgo.config.js';
import type { Config } from 'svgo';
export default defineNuxtConfig({
vite: {
plugins: [
ViteSvgLoader({
svgoConfig: {
plugins: [
'prefixIds',
'removeTitle',
'removeDesc',
'removeDimensions',
{
name: 'removeAttrs',
params: {
attrs: '(fill|stroke)',
},
},
],
},
}),
],
},
});
Hi, I use this is nuxt in my
nuxt.config.ts
like so:Here is my external config file
svgo.config.js
:Here is the error: