Skip to content

calendar组件按需加载的构建错误 #1398

@Chen-Ban

Description

@Chen-Ban

设备型号:

all

LinUI 版本:

0.9.4

微信小程序基础库版本:

all

问题描述及重现步骤:

按照文档在config中添加calendar组件,运行npm run build后, Calendar目录下未build出其所有的components文件及内容

相关截图
图片

补充说明

修改build/until.js中的forParams函数可得到期待结果

const forParams = (arr) => {
  let finishArr = [];
  arr.map(item => {
    let data = fs.readFileSync(`../src/${item}/index.json`, 'utf-8');
    const params = JSON.parse(data);
    const {
      usingComponents
    } = params;
    if (usingComponents && !isEmptyObj(usingComponents)) {
      for (let [key, path] of Object.entries(usingComponents)) {
        if (key.startsWith('l-')) {
          key = key.substring(2, key.length);
        } else {
          key = formatKeyByPath(path, item)
        }
        finishArr.push(key);
      }
      componentArr.push(...finishArr);
      forParams(finishArr);
    }
  });
};

const formatKeyByPath = (path, parent) => {
  path = path.startsWith('./') ? path.replace('./', '').replace('/index', '') : path.replace('/index', '')
  return parent + '/' + path
}

相关截图

图片

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug该 Issue 提出了一个 Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions