简体   繁体   English

更新 Vuetify 但 sass 加载器不起作用

[英]Updating Vuetify but sass loader doesn't work

I am new to vuetify and I am trying upgrade to v2.1.3 but sass loader doesn't work.我是 vuetify 的新手,我正在尝试升级到 v2.1.3,但 sass 加载程序不起作用。 I read all the documentation but my English is not very good, I can't fix this problem.我阅读了所有文档,但我的英语不是很好,我无法解决这个问题。

Actually, I can update vuetify and it works.实际上,我可以更新 vuetify 并且它可以工作。 I can see the new vuetify and I run other things but my Project doesn't see sass.我可以看到新的 vuetify 并运行其他东西,但我的项目没有看到 sass。 This is my problem这是我的问题

My package .json;我的包 .json;

 {
 "name": "arkmanweb",
 "version": "1.9.4",
 "private": true,
 "scripts": {
 "serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@syncfusion/ej2-vue-grids": "^17.3.19",
"axios": "^0.18.0",
"css-loader": "^3.2.1",
"echarts": "^4.2.0-rc.2",
"luxon": "^1.19.3",
"print-js": "^1.0.52",
"quill": "^1.3.6",
"register-service-worker": "^1.0.0",
"sass": "^1.23.7",
"sass-loader": "^8.0.0",
"save": "^2.3.2",
"underscore": "^1.8.3",
"vee-validate": "^2.0.4",
"vue": "^2.5.13",
"vue-i18n": "^8.4.0",
"vue-moment": "^3.2.0",
"vue-router": "^3.0.1",
"vuetify": "^2.1.13",
"vuex": "^3.0.1",
"webpack": "^4.41.2",
   },
  "devDependencies": {
"@vue/cli-plugin-babel": "^3.0.0-alpha.8",
"@vue/cli-plugin-eslint": "^3.0.0-alpha.8",
"@vue/cli-plugin-pwa": "^3.0.0-alpha.8",
"@vue/cli-service": "^3.0.0-alpha.8",
"deepmerge": "^4.2.2",
"fibers": "^4.0.2",
"less-loader": "4.1.0",
"style-loader": "0.23.1",
"vue-template-compiler": "^2.5.13",
"webpack-cli": "^3.1.2"
   },
 "babel": {
 "presets": [
  "@vue/app"
  ]
  },
 "eslintConfig": {
  "extends": [
    "plugin:vue/essential",
   "eslint:recommended"
  ]
   },
"postcss": {
  "plugins": {
  "autoprefixer": {}
 }
 },
 "browserslist": [
 "> 1%",
 "last 2 versions",
 "not ie <= 8"
  ]
 }

This is my main js:这是我的主要js:

import Vue from 'vue'
import App from './App.vue'
import router from './router'  
import store from './store'
import Vuetify from 'vuetify'
import './registerServiceWorker'
import VueResource from 'vue-resource'
import '../src/assets/css/custom.css'
import { i18n } from '@/plugins/i18n'
import 'vuetify/dist/vuetify.min.css'
Vue.use(VueResource)


 const opts = {
  theme: { disable: true }
  }
 Vue.use(Vuetify)

  import auth from '../src/api/auth'


 auth.checkAuth()

 Vue.router = router
 Vue.config.productionTip = false

  new Vue({
   router,
   vuetify:new Vuetify(opts),
   store,
    i18n,
    render: h => h(App)
   }).$mount('#app')

This is App.vue I am importing sass here but doesn't work:这是 App.vue 我在这里导入 sass 但不起作用:

<style lang="sass">
@import '../node_modules/vuetify/src/styles/main.sass';
 </style>

What's wrong?怎么了? Thank you for your help.感谢您的帮助。

This is my error:这是我的错误:

error in ./src/App.vue?vue&type=style&index=0&lang=sass& ./src/App.vue?vue&type=style&index=0&lang=sass& 中的错误

Module build failed (from ./node_modules/sass-loader/dist/cjs.js): ValidationError: Invalid options object.模块构建失败(来自 ./node_modules/sass-loader/dist/cjs.js):ValidationError:无效的选项对象。 Sass Loader has been initialised using an options object that does not match the API schema. Sass Loader 已使用与 API 架构不匹配的选项对象进行初始化。 - options has an unknown property 'data'. - 选项有一个未知的属性“数据”。 These properties are valid: object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter?这些属性是有效的:object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? } }

Its hard to tell based on information you provided but it seems you upgraded sass-loader to version 8.0.0 as part of the upgrade of Vuetify根据您提供的信息很难判断,但作为 Vuetify 升级的一部分,您似乎已将sass-loader升级到 8.0.0 版

There is a breaking change in 8.0.0 release of sass-loader in how the configuration should look like - all the options for the underlying sass processor (Node Sass or Dart Sass) needs now to be moved into sassOptionssass-loader 8.0.0 版本中,配置的外观发生重大变化- 现在需要将底层 sass 处理器(Node Sass 或 Dart Sass)的所有选项移至sassOptions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM