The sitemap is not a constructor when using the action-router-sitemap adapter map

I am trying to create a sitemap for my React site and I am using react-router-sitemap

. Here is mine sitemap-builder.js

:

require('babel-register');

//import React from 'react';
// import { render } from 'react-dom';
//import Sitemap from 'react-router-sitemap';

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')
);

      

And mine package.json

has the following:

"scripts": {
  "build:sitemap": "node ./js/sitemap-builder.js"
},

      

So, I just run it through my terminal with the command:, npm run build:sitemap

but that gives me the following error:

new Sitemap(router)
^

TypeError: Sitemap is not a constructor

      

And I also installed the module; I can see it in mine package.json

. Why does the error occur and how can I fix it?

+3


source to share





All Articles