I'm working on a React app and I want to create a sitemap
for the same. I'm using react-router-sitemap
to generate this sitemap and here is my sitemap-builder.js
:
require('babel-register');
const router = require('./root.js').default;
const Sitemap = require('../').default;
const filterConfig = {
isValid: false,
rules: [
/\/admin/,
/\*/,
],
};
(new Sitemap(router)
.filterPaths(filterConfig)
.build('https://www.ace-up.com')
.save('./sitemap.xml')
);
But every time I run the file, I get the following error:
ReferenceError: window is not defined
at Object.initialize (/< path >/node_modules/react-ga/src/index.js:55:8)
I was getting a similar error for all my js
files also, wherever I could find them but I ended up commenting them out for the time being to make the sitemap work.
What would be the proper way to get the react-router-sitemap
to ignore the window
problem?