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

feat(cli): createTemplateCacheLoader

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