diff --git a/lib/loader.js b/lib/loader.js index 217d7bc3d..d7ba892aa 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -97,7 +97,7 @@ module.exports = function (content) { let output = '' const bustCache = !isProduction && options.cacheBusting !== false - const parts = parse(content, fileName, this.sourceMap, sourceRoot, bustCache) + const parts = parse(content, fileName, this.sourceMap, sourceRoot, bustCache, options) const hasScoped = parts.styles.some(({ scoped }) => scoped) const templateAttrs = parts.template && parts.template.attrs && parts.template.attrs diff --git a/lib/parser.js b/lib/parser.js index d26cc76a1..6b343c26e 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -6,7 +6,7 @@ const SourceMapGenerator = require('source-map').SourceMapGenerator const splitRE = /\r?\n/g const emptyRE = /^(?:\/\/)?\s*$/ -module.exports = (content, filename, needMap, sourceRoot, bustCache) => { +module.exports = (content, filename, needMap, sourceRoot, bustCache, options) => { const cacheKey = hash(filename + content) // source-map cache busting for hot-reloadded modules const filenameWithHash = bustCache @@ -24,7 +24,7 @@ module.exports = (content, filename, needMap, sourceRoot, bustCache) => { sourceRoot ) } - if (output.styles) { + if (output.styles && options.cssSourceMap) { output.styles.forEach(style => { if (!style.src) { style.map = generateSourceMap(