omip - fix compiling error of component

This commit is contained in:
dntzhang 2019-02-25 16:45:07 +08:00
parent 1818c7d0ee
commit ea1f7f8531
3 changed files with 11 additions and 3 deletions

View File

@ -1,7 +1,5 @@
import { WeElement, define } from 'omi'
import '../../components/my-element'
import './index.css'
//获取应用实例

View File

@ -3,7 +3,7 @@ import { WeElement, define } from 'omi'
//兼容 omi 下划线?
import './index.css'
define('my-logs', class extends WeElement {
define('page-logs', class extends WeElement {
data = {
logs: []
}

View File

@ -142,6 +142,16 @@ class Transformer {
this.sourcePath = sourcePath
//@fix add arg => componentSourceMap
this.componentSourceMap = componentSourceMap
//@fix import 却没使用的自定义组件
for (let key of this.componentSourceMap) {
const arr = key[0].split('/')
if (arr[arr.length - 1].indexOf('-') !== -1 && key[0].indexOf('components/') !== -1 && key[1].length === 0) {
this.customComponents.set(arr[arr.length - 1], {
sourcePath: key[0],
type: 'default'
});
}
}
this.moduleNames = Object.keys(path.scope.getAllBindings('module'))
this.componentProperies = new Set(componentProperies)
this.compile()