我们正在使用Extjs 3.1,并尝试将Reactjs集成进去。
我们有一个供应商库,其中包含打包的react、react-dom、redux和其他库作为脚本包含在内。
这是我的Extjs代码。
这是我的Extjs代码。
var CompositeViewer = Ext.extend(Ext.BoxComponent, {
itemId: 'CompositeViewer',
requires: [
'ReactDOM' //my lib file name is vendor.lib.js
],
initComponent: function() {
Ext.apply(this, {
autoEl: {
tag: 'div',
cls: 'normalize'
}
});
CompositeViewer.superclass.initComponent.apply(this, arg);
},
onRender: function(ct, position) {
CompositeViewer.superclass.onRender.apply(this, arg);
console.log(ReactDOM); //OFCOURSE ReactDOM is undefined
/// HOW TO LOAD/Render REACT APP AND OTHER LIBS
},
beforeDestroy: function() {
CompositeViewer.superclass.onDestroy.apply(this, arg);
}
});
需要帮助了解如何将ReactJS/JavaScript库加载到ExtJS容器中。
编辑:进一步澄清。
- 由于我没有从CDN加载外部依赖项(如React,Redux等)的选项,我应该如何单独打包它们以及使用什么类型(commonjs、umd或var)?
- 我该如何打包我的应用程序,以便ExtJS可以导入它(作为单独的库??)