如何在与webpack做出反应的情况下解决scss加载中的解析错误?

时间:2016-01-20 20:14:53

标签: reactjs webpack webpack-style-loader

这是我的超级简单scss文件:

html {
  body {
    font-size: 100%;
    background: url(../img/repeater.jpg);
  }
}

我将其导入我的App.jsx文件:import "./App.scss";

这就是我的模块中的内容:加载器:

            // SASS
            {
                test: /\.scss$/,
                include: /shared/,
                loaders: [
                    'style',
                    'css',
                    'autoprefixer?browsers=last 3 versions',
                    'sass?outputStyle=expanded'
                ]
            }

但是,我在控制台中得到了这个,而不是令人敬畏的事情:

SyntaxError: /Users/jasonshultz/Projects/work/gradebook/shared/containers/App/App.scss: Unexpected token (1:5)
> 1 | html {
    |      ^
  2 |   body {
  3 |     font-size: 100%;
  4 |     background: url(../img/repeater.jpg);
    at Parser.pp.raise (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:1425:13)
    at Parser.pp.unexpected (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:2907:8)
    at Parser.pp.semicolon (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:2894:38)
    at Parser.pp.parseExpressionStatement (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:2264:8)
    at Parser.parseExpressionStatement (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:3596:20)
    at Parser.pp.parseStatement (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:1955:17)
    at Parser.parseStatement (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:3574:22)
    at Parser.pp.parseBlockBody (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:2294:21)
    at Parser.pp.parseTopLevel (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:1823:8)
    at Parser.parse (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:1396:17)

这非常不可靠。如果有帮助的话,我把代码放在github here上。到目前为止,我还没有运气。我尝试了不同的风格,等等。

0 个答案:

没有答案