mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +00:00
Add plugins port settings
This commit is contained in:
parent
102a9a00d1
commit
919a7b33ce
@ -14,6 +14,7 @@ import { ConnectedRouter } from 'react-router-redux';
|
||||
import createHistory from 'history/createBrowserHistory';
|
||||
import _ from 'lodash';
|
||||
import 'sanitize.css/sanitize.css';
|
||||
import 'whatwg-fetch';
|
||||
|
||||
import LanguageProvider from 'containers/LanguageProvider';
|
||||
|
||||
@ -21,6 +22,7 @@ import App from 'containers/App';
|
||||
import { showNotification } from 'containers/NotificationProvider/actions';
|
||||
import { pluginLoaded, updatePlugin } from 'containers/App/actions';
|
||||
|
||||
import { plugins } from '../../config/admin.json';
|
||||
import configureStore from './store';
|
||||
import { translationMessages, languages } from './i18n';
|
||||
|
||||
@ -123,3 +125,18 @@ window.Strapi = {
|
||||
router: history,
|
||||
languages,
|
||||
};
|
||||
|
||||
// Ping each plugins port defined in configuration
|
||||
plugins.ports.forEach(pluginPort => {
|
||||
// Define plugin url
|
||||
const pluginUrl = `http://localhost:${pluginPort}/main.js`;
|
||||
|
||||
// Check that the server in running
|
||||
fetch(pluginUrl)
|
||||
.then(() => {
|
||||
// Inject `script` tag in DOM
|
||||
const script = window.document.createElement('script');
|
||||
script.src = pluginUrl;
|
||||
window.document.body.appendChild(script);
|
||||
});
|
||||
});
|
||||
|
||||
@ -13,5 +13,4 @@
|
||||
<div id="app"></div>
|
||||
<!-- A lot of magic happens in this file. HtmlWebpackPlugin automatically includes all assets (e.g. bundle.js, main.css) with the correct HTML tags, which is why they are missing in this HTML file. Don't add any assets here! (Check out webpackconfig.js if you want to know more) -->
|
||||
</body>
|
||||
<script type="text/javascript" src="http://localhost:3000/main.js"></script>
|
||||
</html>
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
{
|
||||
"languages": ["en", "fr"]
|
||||
"languages": ["en", "fr"],
|
||||
"plugins": {
|
||||
"ports": [3000]
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user