Repository: vuejs/vue-loader
Pull request #656 (2017-02-18 19:21:55)

[docs] pt_BR Updated
Ref: https://github.com/vuejs/vue-loader/pull/655


Patch:
diff --git a/docs/pt_BR/workflow/production.md b/docs/pt_BR/workflow/production.md
index 15a6901..2f454b8 100644
--- a/docs/pt_BR/workflow/production.md
+++ b/docs/pt_BR/workflow/production.md
@@ -24,8 +24,8 @@ module.exports = {
         warnings: false
       }
     }),
-    // otimiza ids de módulos por contagem de ocorrência
-    new webpack.optimize.OccurenceOrderPlugin()
+    // Otimizar ids de módulo por contagem de ocorrências
+    new webpack.optimize.OccurrenceOrderPlugin()
   ]
 }
 ```
diff --git a/lib/gen-id.js b/lib/gen-id.js
index 1919293..e09733d 100644
--- a/lib/gen-id.js
+++ b/lib/gen-id.js
@@ -5,9 +5,9 @@ var hash = require('hash-sum')
 var cache = Object.create(null)
 var sepRE = new RegExp(path.sep.replace('\\', '\\\\'), 'g')
 
-module.exports = function genId (file, context) {
+module.exports = function genId (file, context, key) {
   var contextPath = context.split(path.sep)
   var rootId = contextPath[contextPath.length - 1]
-  file = rootId + '/' + path.relative(context, file).replace(sepRE, '/')
+  file = rootId + '/' + path.relative(context, file).replace(sepRE, '/') + (key || '')
   return cache[file] || (cache[file] = hash(file))
 }
diff --git a/lib/loader.js b/lib/loader.js
index 46aea10..dc91df6 100644
--- a/lib/loader.js
+++ b/lib/loader.js
@@ -62,7 +62,7 @@ module.exports = function (content) {
   var fileName = path.basename(filePath)
 
   var context = (this._compiler && this._compiler.context) || this.options.context || process.cwd()
-  var moduleId = 'data-v-' + genId(filePath, context)
+  var moduleId = 'data-v-' + genId(filePath, context, options.hashKey)
 
   var cssLoaderOptions = ''
   if (!isProduction && this.sourceMap && options.cssSourceMap !== false) {
diff --git a/lib/template-loader.js b/lib/template-loader.js
index 57a5968..02207f6 100644
--- a/lib/template-loader.js
+++ b/lib/template-loader.js
@@ -6,6 +6,9 @@ module.exports = function (content) {
   this.cacheable && this.cacheable()
   var callback = this.async()
   var opt = loaderUtils.parseQuery(this.query)
+
+  // this is never documented and should be deprecated
+  // but we'll keep it so we don't break stuff
   var vue = this.options.__vueOptions__
   if (vue && vue.template) {
     for (var key in vue.template) {
diff --git a/package.json b/package.json
index 8486354..1561546 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "vue-loader",
-  "version": "11.0.0",
+  "version": "11.1.0",
   "description": "Vue single-file component loader for Webpack",
   "main": "index.js",
   "repository": {


Test patch:
diff --git a/test/test.js b/test/test.js
index 579789a..6153927 100644
--- a/test/test.js
+++ b/test/test.js
@@ -162,9 +162,12 @@ describe('vue-loader', function () {
 
   it('scoped style', done => {
     test({
-      entry: './test/fixtures/scoped-css.vue'
+      entry: './test/fixtures/scoped-css.vue',
+      vue: {
+        hashKey: 'foo'
+      }
     }, (window, module) => {
-      var id = 'data-v-' + hash('vue-loader/test/fixtures/scoped-css.vue')
+      var id = 'data-v-' + hash('vue-loader/test/fixtures/scoped-css.vue' + 'foo')
       expect(module._scopeId).to.equal(id)
 
       var vnode = mockRender(module, {