6

我的应用程序.scss

.tes {
    color: red;
}

我执行时的输出错误./node_modules/.bin/webpack

ERROR in ./~/css-loader!./~/sass-loader?indentedSyntax!./www/assets/app.scss
Module build failed: 
.tes {
     ^
      Invalid CSS after ".tes {": expected "}", was "{"
      in ./www/assets/app.scss (line 1, column 7)
 @ ./www/assets/app.scss 4:14-135 13:2-17:4 13:2-17:4 14:20-141

我的webpack.config

 module: {
        loaders: [
            {
                test: /\.scss$/,
                loader: 'style!css!sass?indentedSyntax'
            },
            {
                test: /\.css$/,
                loader: 'style!css'
            }, {
                test: /\.(woff|woff2|ttf|eot|svg)(\?]?.*)?$/,
                loader: 'file-loader?name=res/[name].[ext]?[hash]'
            }
        ]
    },

和我的app.js

require('./www/assets/app.scss');

var angular = require('angular');
var uiRouter = require('angular-ui-router');
require('velocity-animate');
require('node-lumx');

var HomeController = require('./www/components/home/homeController');

angular.module('app', ['lumx', uiRouter]) 
... //OMITED
4

2 回答 2

2

尝试使用不带“indentedSyntax”选项的 sass 加载器作为 'style!css!sass'

您可以在此处阅读文档的更多信息:http: //sass-lang.com/documentation/file.INDENTED_SYNTAX.html

于 2017-01-22T15:14:25.577 回答
1

如果您想使用 sass 语法,解决方案是将文件扩展名更改为 sass,因为从版本 3.2.0 开始,sass-loader 将从文件扩展名派生您想要使用的样式。它对我有用。

于 2016-07-19T07:25:07.980 回答