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

Commit 0bee641

Browse files
committed
fix: generate sourcemaps even if previous maps are provided
1 parent e6fa1ba commit 0bee641

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/style-compiler/index.js

-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ module.exports = function compileStyle (style, filename, config) {
2121

2222
// source map
2323
if (config.needMap) {
24-
if (!style.map) {
25-
throw Error('Previous source map is missing.')
26-
}
27-
2824
options.map = {
2925
inline: false,
3026
annotation: false,

test/style-compiler.test.js

+11
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,14 @@ test('should rewrite scoped style', () => {
1010
const compiled = compiler(style, 'foo.vue', { scopeId: 'xxx', needMap: false })
1111
expect(compiled.code.indexOf('.foo[xxx]')).toBeGreaterThan(-1)
1212
})
13+
14+
test('should generate sourcemap', () => {
15+
const style = {
16+
code: '.foo { color: red }',
17+
descriptor: {
18+
scoped: true
19+
}
20+
}
21+
const compiled = compiler(style, 'foo.vue', { scopeId: 'xxx' })
22+
expect(compiled.map).toBeTruthy()
23+
})

0 commit comments

Comments
 (0)