Answer the question
In order to leave comments, you need to log in
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'
})
]
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question