File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ var hash = require('hash-sum')
5
5
var cache = Object . create ( null )
6
6
var sepRE = new RegExp ( path . sep . replace ( '\\' , '\\\\' ) , 'g' )
7
7
8
- module . exports = function genId ( file , context ) {
8
+ module . exports = function genId ( file , context , key ) {
9
9
var contextPath = context . split ( path . sep )
10
10
var rootId = contextPath [ contextPath . length - 1 ]
11
- file = rootId + '/' + path . relative ( context , file ) . replace ( sepRE , '/' )
11
+ file = rootId + '/' + path . relative ( context , file ) . replace ( sepRE , '/' ) + ( key || '' )
12
12
return cache [ file ] || ( cache [ file ] = hash ( file ) )
13
13
}
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ module.exports = function (content) {
62
62
var fileName = path . basename ( filePath )
63
63
64
64
var context = ( this . _compiler && this . _compiler . context ) || this . options . context || process . cwd ( )
65
- var moduleId = 'data-v-' + genId ( filePath , context )
65
+ var moduleId = 'data-v-' + genId ( filePath , context , options . hashKey )
66
66
67
67
var cssLoaderOptions = ''
68
68
if ( ! isProduction && this . sourceMap && options . cssSourceMap !== false ) {
Original file line number Diff line number Diff line change @@ -162,9 +162,12 @@ describe('vue-loader', function () {
162
162
163
163
it ( 'scoped style' , done => {
164
164
test ( {
165
- entry : './test/fixtures/scoped-css.vue'
165
+ entry : './test/fixtures/scoped-css.vue' ,
166
+ vue : {
167
+ hashKey : 'foo'
168
+ }
166
169
} , ( window , module ) => {
167
- var id = 'data-v-' + hash ( 'vue-loader/test/fixtures/scoped-css.vue' )
170
+ var id = 'data-v-' + hash ( 'vue-loader/test/fixtures/scoped-css.vue' + 'foo' )
168
171
expect ( module . _scopeId ) . to . equal ( id )
169
172
170
173
var vnode = mockRender ( module , {
You can’t perform that action at this time.
0 commit comments