File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
// utility for generating a uid for each component file
2
2
// used in scoped CSS rewriting
3
+ var path = require ( 'path' )
3
4
var hash = require ( 'hash-sum' )
4
5
var cache = Object . create ( null )
5
6
6
- module . exports = function genId ( file ) {
7
+ module . exports = function genId ( file , context ) {
8
+ context = context || process . cwd ( )
9
+ var contextPath = context . split ( path . sep )
10
+ var rootId = contextPath [ contextPath . length - 1 ]
11
+ file = rootId + '/' + path . relative ( context , file )
7
12
return cache [ file ] || ( cache [ file ] = hash ( file ) )
8
13
}
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ module.exports = function (content) {
60
60
61
61
var filePath = this . resourcePath
62
62
var fileName = path . basename ( filePath )
63
- var moduleId = 'data-v-' + genId ( filePath )
63
+ var moduleId = 'data-v-' + genId ( filePath , this . _compiler . context )
64
64
var styleRewriter = styleRewriterPath + '?id=' + moduleId
65
65
66
66
var cssLoaderOptions = ''
You can’t perform that action at this time.
0 commit comments