diff --git a/lib/intermediate-representation-dir/production-app.js b/lib/intermediate-representation-dir/production-app.js index c650556e28af6..d08ab09c59b8e 100644 --- a/lib/intermediate-representation-dir/production-app.js +++ b/lib/intermediate-representation-dir/production-app.js @@ -50,6 +50,15 @@ runtime.install({ const rootElement = document.getElementById(`react-mount`) const rootRoute = require(`./split-child-routes`) +// If you try to load the split-child-routes module in other +// modules, Webpack freezes in some sort of infinite loop when +// you try to build the javascript for production. No idea +// why... so for now we'll pop the routes on window. I hope no +// one feels overly dirty from reading this ;-) +if (typeof window !== 'undefined') { + window.gatsbyRootRoute = rootRoute +} + let currentLocation browserHistory.listen(location => { currentLocation = location