3
the remote file is a single components compiled by webpack
the wenpack config as follow:
{
.....
library: library
,externals: externals
,libraryTarget: "umd"
.....
}
die Komponenten im CDN, ich möchte laden und verwenden Sie die Remote-Komponenten in reagieren laden. und wie es wie die Pseudo-Code zu verwenden:Wie Remote-Datei in webpack
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;
zuerst, thaks für Ihre Frage, ich fand die gleiche Idee wie Sie, https://github.com/yariv/ReactScriptLoader – abnerCrack
Ich gebe dies ein +1, weil einer der Schöpfer von Webpack hatte die gleiche Antwort hier: https : //github.com/webpack/webpack/issues/240#issuecomment-40686135 – Ryan