File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ var assign = require('object-assign')
3
3
var selectorPath = require . resolve ( './selector' )
4
4
var parserPath = require . resolve ( './parser' )
5
5
var hash = require ( 'hash-sum' )
6
+ var path = require ( 'path' )
6
7
7
8
var defaultLang = {
8
9
template : 'html' ,
@@ -29,7 +30,9 @@ module.exports = function (content) {
29
30
var output = ''
30
31
var options = this . options . vue || { }
31
32
var vueUrl = loaderUtils . getRemainingRequest ( this )
32
- var moduleId = '_v-' + hash ( this . resourcePath )
33
+ var filePath = this . resourcePath
34
+ var fileName = path . basename ( filePath )
35
+ var moduleId = '_v-' + hash ( filePath )
33
36
34
37
// check if there are custom loaders specified with
35
38
// vueLoader.withLoaders(), otherwise use defaults
@@ -97,11 +100,12 @@ module.exports = function (content) {
97
100
}
98
101
99
102
function getRewriter ( type , scoped ) {
103
+ var meta = '?id=' + moduleId + '&file=' + fileName
100
104
switch ( type ) {
101
105
case 'template' :
102
- return scoped ? ( rewriters . template + '?id=' + moduleId + '!' ) : ''
106
+ return scoped ? ( rewriters . template + meta + '!' ) : ''
103
107
case 'style' :
104
- return rewriters . style + '?id=' + moduleId + ( scoped ? '&scoped=true!' : '!' )
108
+ return rewriters . style + meta + ( scoped ? '&scoped=true!' : '!' )
105
109
default :
106
110
return ''
107
111
}
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ module.exports = function (css, map) {
56
56
}
57
57
58
58
// postcss options, for source maps
59
- var file = loaderUtils . getRemainingRequest ( this )
59
+ var file = this . resourcePath
60
60
var opts
61
61
opts = {
62
62
from : file ,
@@ -74,7 +74,11 @@ module.exports = function (css, map) {
74
74
postcss ( plugins )
75
75
. process ( css , opts )
76
76
. then ( function ( result ) {
77
- cb ( null , result . css , result . map )
77
+ var map = JSON . parse ( result . map . toString ( ) )
78
+ // ensure we give the style source a unique name
79
+ // so that Webpack doesn't get confused
80
+ map . sources [ 0 ] = query . file + '.style'
81
+ cb ( null , result . css , map )
78
82
} )
79
83
. catch ( function ( e ) {
80
84
console . log ( e )
You can’t perform that action at this time.
0 commit comments