使用Sass运行Vuetify时模块生成错误

时间:2020-06-24 15:42:11

标签: node.js vue.js webpack sass vuetify.js

我将Webpack与Vuetify一起使用,编译时出现SASS错误。我的webpack配置文件是:


'use strict'

const path = require('path');
const { VueLoaderPlugin } = require("vue-loader");

module.exports = {
  mode: 'development',
  entry: './index.js',
  output: {
    filename: 'app.js',
    path: path.resolve(__dirname, 'js'),
  },
  module: {
    rules: [
      { test: /\.vue$/, use: 'vue-loader' },
      {
        test: /\.(scss|sass|css)/,
        use: [
          'vue-style-loader',
          'css-loader',
          {
            loader: 'sass-loader',
            // Requires sass-loader@^7.0.0
            // options: {
            //   implementation: require('sass'),
            //   fiber: require('fibers'),
            //   indentedSyntax: true // optional
            // },
            // Requires sass-loader@^8.0.0
            options: {
              implementation: require('sass'),
              sassOptions: {
                fiber: require('fibers'),
                indentedSyntax: true // optional
              },
            },
          },
        ],
      }
    ]
  },
  plugins: [new VueLoaderPlugin()]
};

构建时收到的错误是:

ERROR in ./node_modules/vuetify/dist/vuetify.min.css (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js??ref--1-2!./node_modules/vuetify/dist/vuetify.min.css)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Expected newline.
  ╷
1 │ @charset "UTF-8";
  │                 ^

我确信我必须在某个地方的样式加载器的选项中缺少某些设置,但是我不知道是什么。谁能看到我要去哪里错了?

0 个答案:

没有答案