【发布时间】:2016-08-12 22:10:41
【问题描述】:
the remote file is a single components compiled by webpack
the wenpack config as follow:
{
.....
library: library
,externals: externals
,libraryTarget: "umd"
.....
}
组件在cdn中, 我想在反应中加载和使用远程组件。 以及如何像伪代码一样使用它:
ajax -> get a json > { components name } > use the name to load romote file
for example the json have the botton i need to load the botton.min.js
var Button = reuqire('http://botton.min.js')
class App extends React.Component {
render() {
return (
<div>
<Botton/>
</div>
);
}
}
export default App;
【问题讨论】:
标签: asynchronous reactjs webpack