xcatliu / pagic

A static site generator powered by Deno + React
https://pagic.org
MIT License
1.64k stars 104 forks source link

fix: config.head has only one child #81

Closed Shenfq closed 1 year ago

Shenfq commented 3 years ago

配置文件中,如果在 head 属性中使用 Fragments,且只配置了一个子节点,得到的 element.props.children 为一个对象,而非数组。

export default {
  head: <>
    <script src="/assets/hm.js" />
  </>
}

image

增加一层判断,如果不为数组,这直接调用 traverseElement 方法。

xcatliu commented 1 year ago

之前不小心在 force-pushed 中提交了,这里重新 merge 了一次,感谢 @Shenfq