I am currently attempting to activate sourceMaps in webpack, but I am encountering an issue with the combination of sass-loader and postcss-loader.
When both sass-loader and postcss-loader are enabled, my console displays "no source":
https://i.sstatic.net/cVuSy.png
However, when I disable postcss-loader, the sourceMap functions correctly and points to the "typography" file:
https://i.sstatic.net/ZDM9h.png
webpack.config.js
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
mode: 'development',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist',
filename: 'js/bundle.js',
},
devtool: 'inline-source-map',
module: {
rules: [{
test: /\.css$/i,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader']
})
},
{
test: /\.scss$/i,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'postcss-loader',
options: {
sourceMap: true
}
},
{
loader: 'sass-loader',
options: {
sourceMap: true
}
}
]
})
},
{
test: /\.js$/i,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
plugins: [
new ExtractTextPlugin('css/style.css')
]
};
main.scss
@import 'typography';
typography.scss
p {
font-size: responsive 12px 18px;
}