Skip to content

only generate css source map when cssSourceMap is enabled #1070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down