Sourcemaps with webpack css-loader
Enable source-maps via webpack
...
devtool: 'source-map'
...You might want to enable source-maps for Sass-Files as well
module: {
loaders: [
...
{
test: /\.scss$/,
loaders: [
'style-loader',
'css-loader?sourceMap',
'sass-loader?sourceMap'
]
}, {
test: /\.css$/,
loaders: [
"style-loader",
"css-loader?sourceMap"
]
},
...
]
}Use extract text plugin to extract your css into a file.
...
plugins: [
...
new ExtractTextPlugin('file.css')
]
...
sourceMap with sass-loader and postcss-loader in Webpack
You can give the following a try. This is what I'm using and it's working.
{
test: /\.(sa|sc|c)ss$/,
exclude: ['/node_modules', './dist', '/src/js', '/docs'],
use: [
MiniCSSExtractPlugin.loader,
{
loader: 'css-loader',
options: {
sourceMap: true,
minimize: process.env.NODE_ENV === 'production',
}
},
{
loader: 'postcss-loader',
options: {
sourceMap: true,
syntax: postCssScss,
plugins: () => [
autoprefixer,
postCssPresetEnv({
stage: 0,
features: {
'color-mod-function': true,
'alpha-hex-colors': true
}
}),
],
},
},
{
loader: 'sass-loader',
options: {
sourceMap: true
}
}
]
}
The extractTextPlugin has been deprecated for Webpack4 in favor of miniCssExtractPlugin
Related Topics
Webpack - Require('Node_Modules/Leaflet/Leaflet.CSS')
Force to Show Invalid-Feedback in Bootstrap 4
Body { Font-Size: 100.01%; } Vs Body { Font-Size: 100%; }
Tailwind CSS How to Code Pixel Perfect Design
Overriding Styles in Semantic UI React
Twitter Bootstrap 3.0 Row Wider Than Window
How to Install Bootstrap in Laravel 8
Bootstrap Remove Upward Arrow in Dropdown
How to Clear The Last <Li> Tag Within a <Ul>
Inner Div Locked to Lower Right Hand Corner of Outer Div
How to Do Horizontal Scroll in Ionic 3
How to Remove The Bold from a Headline
Background Color in Tabsetpanel in Shiny
Align Text Baseline with a Button in CSS