提交 6acf9b77 编写于 作者: Q qiang

fix: 解决开启 treeShaking 后 picker 组件无法使用的问题 fixed #841

上级 0b565cb5
......@@ -6,16 +6,26 @@ const {
capitalize
} = require('./util')
const platformTags = ['audio', 'map', 'video', 'web-view', 'cover-view', 'cover-image']
const platformTags = ['audio', 'map', 'video', 'web-view', 'cover-view', 'cover-image', 'picker']
//input 在 pageHead 中有使用,resize-sensor 在很多组件中有使用,暂时直接加载
const autoloadTags = ['input', 'resize-sensor']
const autoloadTags = {
// input 在 pageHead 中有使用,resize-sensor 在很多组件中有使用,暂时直接加载
root: ['input', 'resize-sensor'],
other: {
picker: ['picker-view', 'picker-view-column']
}
}
module.exports = function updateComponents(tags) {
autoloadTags.forEach(tagName => {
autoloadTags.root.forEach(tagName => {
tags.add(tagName)
})
tags = [...tags]
Object.keys(autoloadTags.other).forEach(tagName => {
if (tags.includes(tagName)) {
tags.push(...autoloadTags.other[tagName])
}
})
const importsStr = tags.map(tagName => {
if (platformTags.indexOf(tagName) !== -1) {
return `import ${capitalize(camelize(tagName))} from 'uni-platform/view/components/${tagName}'`
......@@ -44,4 +54,4 @@ ${componentsStr}
fs.writeFileSync(path.resolve(dir, 'components.js'), content, 'utf8')
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册