Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
fix: generate sourcemaps even if previous maps are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
znck committed Oct 28, 2017
1 parent e6fa1ba commit 0bee641
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/style-compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ module.exports = function compileStyle (style, filename, config) {

// source map
if (config.needMap) {
if (!style.map) {
throw Error('Previous source map is missing.')
}

options.map = {
inline: false,
annotation: false,
Expand Down
11 changes: 11 additions & 0 deletions test/style-compiler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ test('should rewrite scoped style', () => {
const compiled = compiler(style, 'foo.vue', { scopeId: 'xxx', needMap: false })
expect(compiled.code.indexOf('.foo[xxx]')).toBeGreaterThan(-1)
})

test('should generate sourcemap', () => {
const style = {
code: '.foo { color: red }',
descriptor: {
scoped: true
}
}
const compiled = compiler(style, 'foo.vue', { scopeId: 'xxx' })
expect(compiled.map).toBeTruthy()
})

0 comments on commit 0bee641

Please sign in to comment.