Skip to content

Commit 4684422

Browse files
author
evilebottnawi
committed
Fixed: generate source maps when they are actually requested.
1 parent e8d3dc2 commit 4684422

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/loader.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = function(content, map) {
2222
if(sourceMap && map !== null && typeof map !== "string") {
2323
map = JSON.stringify(map);
2424
} else {
25-
// Some loaders (example `postcss-loader: 1`) always generate source map, we should remove their
25+
// Some loaders (example `"postcss-loader": "1.x.x"`) always generates source map, we should remove their
2626
map = null;
2727
}
2828

@@ -32,7 +32,8 @@ module.exports = function(content, map) {
3232
to: loaderUtils.getCurrentRequest(this),
3333
query: query,
3434
minimize: this.minimize,
35-
loaderContext: this
35+
loaderContext: this,
36+
sourceMap: sourceMap
3637
}, function(err, result) {
3738
if(err) return callback(err);
3839

lib/processCss.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@ module.exports = function processCss(inputSource, inputMap, options, callback) {
191191
// we need a prefix to avoid path rewriting of PostCSS
192192
from: "/css-loader!" + options.from,
193193
to: options.to,
194-
map: {
194+
map: options.sourceMap ? {
195195
prev: inputMap,
196196
sourcesContent: true,
197197
inline: false,
198198
annotation: false
199-
}
199+
} : null
200200
}).then(function(result) {
201201
callback(null, {
202202
source: result.css,

0 commit comments

Comments
 (0)