2016-09-10 16:28:57 +05:30
|
|
|
// NOTE: we are requiring with require(), to enable dynamic dependencies
|
|
|
|
// depending on ENV, where App is running in.
|
|
|
|
// This allows us better support of hmr and reduces bundle size
|
2016-08-30 12:32:00 +05:30
|
|
|
|
2019-03-17 04:07:00 +05:30
|
|
|
const React = require('react');
|
|
|
|
|
2016-09-04 21:08:36 +05:30
|
|
|
/* global process: false */
|
2016-09-10 16:28:57 +05:30
|
|
|
// eslint-disable-next-line no-negated-condition
|
2016-09-04 21:08:36 +05:30
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
2016-09-10 16:28:57 +05:30
|
|
|
const ReactDOM = require('react-dom');
|
2016-09-04 21:08:36 +05:30
|
|
|
const DevApp = require('devTools').default;
|
2016-08-30 12:32:00 +05:30
|
|
|
|
2016-09-04 14:49:14 +05:30
|
|
|
ReactDOM.render(
|
2016-09-04 21:08:36 +05:30
|
|
|
<DevApp />,
|
2016-09-04 14:49:14 +05:30
|
|
|
document.getElementById('app')
|
|
|
|
);
|
2016-09-10 16:28:57 +05:30
|
|
|
} else {
|
|
|
|
const ReactDOMServer = require('react-dom/server');
|
2019-03-17 04:07:00 +05:30
|
|
|
const { Html } = require('components');
|
2016-09-10 16:28:57 +05:30
|
|
|
const App = require('App').default;
|
2016-09-04 21:08:36 +05:30
|
|
|
|
2016-09-10 16:28:57 +05:30
|
|
|
module.exports = {
|
|
|
|
default(props) {
|
2016-09-27 10:32:19 +05:30
|
|
|
if (props.assetsHost) {
|
2019-03-17 04:07:00 +05:30
|
|
|
// noinspection JSUnresolvedVariable
|
2016-09-27 10:32:19 +05:30
|
|
|
__webpack_public_path__ = props.assetsHost.replace(/\/*$/, '/'); // eslint-disable-line
|
|
|
|
|
|
|
|
Reflect.deleteProperty(props, 'assetsHost');
|
|
|
|
}
|
|
|
|
|
2016-09-11 13:42:46 +05:30
|
|
|
return ReactDOMServer.renderToStaticMarkup(
|
|
|
|
<Html>
|
|
|
|
<App {...props} />
|
|
|
|
</Html>
|
|
|
|
);
|
2016-09-10 16:28:57 +05:30
|
|
|
}
|
|
|
|
};
|
2016-09-04 21:08:36 +05:30
|
|
|
}
|