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 11// utility for generating a uid for each component file
22// used in scoped CSS rewriting
3+ var path = require ( 'path' )
34var hash = require ( 'hash-sum' )
45var cache = Object . create ( null )
56
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 )
712 return cache [ file ] || ( cache [ file ] = hash ( file ) )
813}
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ module.exports = function (content) {
6060
6161 var filePath = this . resourcePath
6262 var fileName = path . basename ( filePath )
63- var moduleId = 'data-v-' + genId ( filePath )
63+ var moduleId = 'data-v-' + genId ( filePath , this . _compiler . context )
6464 var styleRewriter = styleRewriterPath + '?id=' + moduleId
6565
6666 var cssLoaderOptions = ''
You can’t perform that action at this time.
0 commit comments