weex
weex copied to clipboard
为什么Weex-loader-0.3.1还是不支持在 js 中 require('@weex-module/stream');

@Jinjiang
@RLZHU
这边有个临时的方案:
如果require 语句是否在一个 .js 文件中,而不是在 .we 文件中。则暂时可以通过以下特殊写法实现:
// use this piece of code below to get Weex native module "modal"
var modal
__weex_define__('@weex-temp/x', function (__weex_require__) {
modal = __weex_require__('@weex-module/modal')
})
// use APIs in "modal" module
modal.toast({message: 'hello'})
@jinyue-rdj
还可以参考这里 https://github.com/weexteam/article/issues/20