1.堆栈:节点版本:19.9 nuxt:“3.4.1”vuetify:“3.1.14”
1.问题:在nuxt 3项目上工作3/4小时后,vuetify组件停止被识别,并且在控制台中出现错误:console push warnings
1.代码- nuxt设置
nuxt.config.ts
export default defineNuxtConfig({
css: [
'vuetify/lib/styles/main.sass',
'@mdi/font/css/materialdesignicons.min.css',
],
build: {
transpile: ['vuetify'],
},
modules: [
'@nuxtjs/i18n',
'@nuxtjs/eslint-module',
],
i18n: {
lazy: true,
langDir: 'locales',
strategy: 'prefix_except_default',
defaultLocale: 'en-Us',
locales: [
{
code: 'en-Us',
file: 'en-US.js',
name: 'English(US)',
iso: 'en-US',
}
]
},
vite: {
define: {
'process.env.DEBUG': false,
},
},
});
~/pluging/vuetify.ts
import 'vuetify/styles';
import { createVuetify } from 'vuetify';
import * as components from 'vuetify/components';
import * as directives from 'vuetify/directives';
import { md1 } from 'vuetify/blueprints';
export default defineNuxtPlugin((nuxt) => {
const vuetify = createVuetify({
ssr: true,
components,
directives,
blueprint: md1,
theme: {
defaultTheme: 'dark',
}
});
nuxt.vueApp.use(vuetify);
});
~/pages/index.vuein vscode everything looks like good, I can see types etc
我遵循了这个教程:https://codybontecou.com/how-to-use-vuetify-with-nuxt-3.html。
正如我提到的,有一段时间它是工作,但后来...不知道发生了什么,也许添加eslint cused这个问题?
1条答案
按热度按时间2w2cym1i1#
好吧,这是我的错误。而不是有文件夹
plugins
,我有文件夹名为plugin