When I am trying to read the react file that contains the router node crash with error ( i want to build sitemap but even if i just try to console.log the export default variable i am getting this error maybe babel wrong configuration?):
redux\store.js:80 var store = (0, _redux.createStore)(_index2.default, defaultState, (0, _redux.compose)((0, _redux.applyMiddleware)(_reduxThunk2.default), window.devToolsExtension ? window.devToolsExtension() : function (f) { ^
ReferenceError: window is not defined
Is it possible to fix that error?
react file test.js
require('es6-promise').polyfill();
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import store, { history } from './redux/store';
import { Router, Route, IndexRoute } from 'react-router';
import App from './app';
....
const renderRouter = (<Provider store={store}>
<Router history={history} >
<Route path="/" component={App}>
.....
</Router>
</Prodiver
)
export default renderRouter;
sitemap file
require('babel-register');
const renderRouter = require('./test').default;
console.log(renderRouter);
/*
const Sitemap = require('react-router-sitemap').default;
(
new Sitemap(router)
.build('https://www.omgomg.com')
.save('./sitemap.xml')
);*/
EDIT: If i remove import store and history and I get @import error from App component ( it has scss file so I believe babel isn't config to read scss? )
react file test.js
require('es6-promise').polyfill();
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
/*import store, { history } from './redux/store';*/
import { Router, Route, IndexRoute } from 'react-router';
const App = 0;
....
const renderRouter = (<Provider >
<Router >
<Route path="/" component={App}>
.....
</Router>
</Prodiver
)
export default renderRouter;