提交 69a2a6c3 编写于 作者: fxy060608's avatar fxy060608

refactor(mp): add hash (vueId) #1200

上级 71fbb175
const path = require('path') const path = require('path')
const hash = require('hash-sum')
const parser = require('@babel/parser') const parser = require('@babel/parser')
const { const {
...@@ -95,6 +95,11 @@ module.exports = { ...@@ -95,6 +95,11 @@ module.exports = {
options.mp.scopeId = options.scopeId options.mp.scopeId = options.scopeId
options.mp.resourcePath = options.resourcePath options.mp.resourcePath = options.resourcePath
if (options.resourcePath) {
options.mp.hashId = hash(options.resourcePath)
} else {
options.mp.hashId = ''
}
options.mp.globalUsingComponents = options.globalUsingComponents || Object.create(null) options.mp.globalUsingComponents = options.globalUsingComponents || Object.create(null)
......
...@@ -58,7 +58,8 @@ function addVueId (path, state) { ...@@ -58,7 +58,8 @@ function addVueId (path, state) {
if (!state.options.hasOwnProperty('$vueId')) { if (!state.options.hasOwnProperty('$vueId')) {
state.options.$vueId = 1 state.options.$vueId = 1
} }
const vueId = String(state.options.$vueId++) const hashId = state.options.hashId
const vueId = String((hashId ? (hashId + '-') : '') + (state.options.$vueId++))
let value let value
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册