提交 9c91a22c 编写于 作者: fxy060608's avatar fxy060608

feat(cli): createTemplateCacheLoader

上级 4b7ee1f4
......@@ -62,14 +62,14 @@ function read (key, callback) {
}
module.exports = {
createTemplateCacheLoader: function (api) {
createTemplateCacheLoader: function (api, id = 'uni-template-compiler') {
return {
resourceQuery: /type=uni-cache-loader-template/,
use: [{
loader: 'cache-loader',
ident: 'uni-cache-loader-template-options',
options: Object.assign(api.genCacheConfig(
'uni-template-compiler/' + process.env.UNI_PLATFORM,
id + '/' + process.env.UNI_PLATFORM,
getPartialIdentifier()
), {
read,
......
......@@ -16,17 +16,16 @@ module.exports = {
'link,meta,param,source,track,wbr'
),
getPartialIdentifier () {
if (partialIdentifier) {
return partialIdentifier
}
partialIdentifier = {
'UNI_COMPILER_VERSION': require('../package.json').version
}
Object.keys(process.env).forEach(name => {
if (name.indexOf('UNI_') === 0) {
partialIdentifier[name] = process.env[name]
if (!partialIdentifier) {
partialIdentifier = {
'UNI_COMPILER_VERSION': require('../package.json').version
}
})
Object.keys(process.env).forEach(name => {
if (name.indexOf('UNI_') === 0) {
partialIdentifier[name] = process.env[name]
}
})
}
return partialIdentifier
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册