verekia / js-stack-from-scratch

🛠️⚡ Step-by-step tutorial to build a modern JavaScript stack.
MIT License
20.09k stars 1.99k forks source link

How to add SCSS? #217

Closed iblh closed 7 years ago

iblh commented 7 years ago

Type of issue: question

If it's a bug: no

I have added css-loader node-sass sass-loader style-loader and webpack.config.babel.js is

// [...]
  module: {
    rules: [
    // [...]
    {
      test: /\.(css|scss)$/,
      use: [{
        loader: 'style-loader', // creates style nodes from JS strings
      }, {
        loader: 'css-loader', // translates CSS into CommonJS
      }, {
        loader: 'sass-loader', // compiles Sass to CSS
      }],
    }],
  },
// [...]

while I import a scss file, the yarn start will throw err:

SyntaxError: /src/shared/component/style.scss: Unexpected token, expected ; (1:3)
> 1 | h1 {
    |    ^
  3 |   color: Cyan;
  4 | }