File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -9,20 +9,25 @@ var options = {
9
9
modules : [ {
10
10
postTransformNode ( el ) {
11
11
if ( el . tag === 'img' ) {
12
- el . staticAttrs && el . staticAttrs . some ( rewrite )
12
+ el . attrs && el . attrs . some ( rewrite )
13
13
}
14
14
}
15
15
} ]
16
16
}
17
17
18
18
function rewrite ( attr ) {
19
19
if ( attr . name === 'src' ) {
20
- var firstChar = attr . value . charAt ( 1 )
20
+ var value = attr . value
21
+ var isStatic = value . charAt ( 0 ) === '"' && value . charAt ( value . length - 1 ) === '"'
22
+ if ( ! isStatic ) {
23
+ return
24
+ }
25
+ var firstChar = value . charAt ( 1 )
21
26
if ( firstChar === '.' || firstChar === '~' ) {
22
27
if ( firstChar === '~' ) {
23
- attr . value = '"' + attr . value . slice ( 2 )
28
+ value = '"' + value . slice ( 2 )
24
29
}
25
- attr . value = `require(${ attr . value } )`
30
+ attr . value = `require(${ value } )`
26
31
}
27
32
return true
28
33
}
Original file line number Diff line number Diff line change 40
40
"source-map" : " ^0.5.6" ,
41
41
"vue-hot-reload-api" : " ^2.0.1" ,
42
42
"vue-style-loader" : " ^1.0.0" ,
43
- "vue-template-compiler" : " ^2.0.0-alpha.8 "
43
+ "vue-template-compiler" : " ^2.0.0-beta.6 "
44
44
},
45
45
"peerDependencies" : {
46
46
"css-loader" : " ^0.23.1"
You can’t perform that action at this time.
0 commit comments