2016-08-10 21:36:11 +02:00
|
|
|
/**
|
|
|
|
* This is the main JS entry point in development build.
|
|
|
|
*/
|
2016-07-26 13:21:37 +02:00
|
|
|
import React from "react";
|
|
|
|
import ReactDOM from "react-dom";
|
|
|
|
|
2016-08-10 21:36:11 +02:00
|
|
|
// Load react-a11y for accessibility overview
|
2016-07-26 13:21:37 +02:00
|
|
|
var a11y = require("react-a11y");
|
|
|
|
a11y(React, { ReactDOM: ReactDOM, includeSrcNode: true });
|
|
|
|
|
2016-08-10 21:36:11 +02:00
|
|
|
// Load common index
|
2016-07-28 23:14:52 +02:00
|
|
|
const index = require("./index.all.js");
|
|
|
|
|
2016-08-10 21:36:11 +02:00
|
|
|
// Initial rendering function from common index
|
2016-07-28 23:14:52 +02:00
|
|
|
var render = index.onWindowIntl();
|
2016-08-10 21:36:11 +02:00
|
|
|
if (module.hot) {
|
|
|
|
// If we support hot reloading of components,
|
|
|
|
// display an overlay for runtime errors
|
2016-07-28 23:14:52 +02:00
|
|
|
const renderApp = render;
|
|
|
|
const renderError = (error) => {
|
2016-07-30 22:54:19 +02:00
|
|
|
const RedBox = require("redbox-react").default;
|
2016-07-28 23:14:52 +02:00
|
|
|
ReactDOM.render(
|
|
|
|
<RedBox error={error} />,
|
|
|
|
index.rootElement
|
|
|
|
);
|
|
|
|
};
|
2016-08-10 21:36:11 +02:00
|
|
|
|
|
|
|
// Try to render, and display an overlay for runtime errors
|
2016-07-28 23:14:52 +02:00
|
|
|
render = () => {
|
|
|
|
try {
|
|
|
|
renderApp();
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error);
|
|
|
|
renderError(error);
|
|
|
|
}
|
|
|
|
};
|
2016-08-10 21:36:11 +02:00
|
|
|
|
2016-07-28 23:14:52 +02:00
|
|
|
module.hot.accept("./app/containers/Root", () => {
|
|
|
|
setTimeout(render);
|
|
|
|
});
|
|
|
|
}
|
2016-08-10 21:36:11 +02:00
|
|
|
|
|
|
|
// Perform i18n and render
|
2016-07-28 23:14:52 +02:00
|
|
|
index.Intl(render);
|