A
A
Andrey Pushkin2018-07-22 20:58:13
JavaScript
Andrey Pushkin, 2018-07-22 20:58:13

How to setup source map for sass in webpack?

Well, actually, the point is in the title. Google did not suggest anything good, or I gave the wrong request)

const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
  entry: { main: './src/index.js' },
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'main.js'
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader"
        }
      },
      {
        test: /\.sass$/,
        use: ExtractTextPlugin.extract(
          {
            fallback: 'style-loader',
            use: [
              {
                loader: 'css-loader',
                sourceMap: true
              },
              {
                loader: 'postcss-loader',
                sourceMap: true
              },
              {
                loader: 'sass-loader',
                sourceMap: true
              }
              ]}

        )
      }
    ]
  },
    plugins: [
      new ExtractTextPlugin({filename: 'style.css'}),
      new HtmlWebpackPlugin({
        inject: false,
        hash: true,
        template: './src/index.html',
        filename: 'index.html'
      })
    ]
  };

Well, and a screen from Mozilla
skrinshoter.ru/s/220718/trEHnRN3?a
I'm obviously doing something wrong

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2018-07-22
@alexey-m-ukolov

https://github.com/webpack-contrib/sass-loader#sou...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question