Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
react-router-sitemap giving error Failed at the action@0.1.0 sitemap script

I have a React router-based Single-Page-App and I'm trying to generate the sitemap links using react-router-sitemap version:^1.2.0 but I'm getting the same error again. And giving me errors in the CSS files.

Routes.js

import React from 'react';
import { Route, Routes } from "react-router-dom"

import GameComponent from './GameComponent';
import PlayGame from './PlayGame';
import PrivacyPolicy from './PrivacyPolicy';
import TermsConditions from './TermsConditions';

function Routesdef(props) {
    return (

        <Routes>
            <Route exact path="/" element={<GameComponent suggested__Games={props.suggested__Games} games={props.ALL__GAMES} key="all" />} />
            <Route exact path="/gamecomponent/:category" element={<GameComponent suggested__Games={props.suggested__Games} games={props.ALL__GAMES} key="categoryWise" />} />
            <Route path="/playgame/:gamename/:title/:gameSource/:category/:index" element={<PlayGame games={props.ALL__GAMES} suggested__Games={props.suggested__Games} key="playing" />} />
            <Route exact path="/privacypolicy" element={<PrivacyPolicy />} />
            <Route exact path="/termsconditions" element={<TermsConditions />} />
        </Routes>

    )
}
export default Routesdef

sitemap-generator.js

require("babel-register")({
  presets: ["es2015", "react"]
});

const router = require('./Routes.js').default;
const Sitemap = require('react-router-sitemap').default;

(
  new Sitemap(router)
    .build('https://www.onlineplaygames.online')
    .save('./public/sitemap.xml')
);

Scripts in Package.json

  "scripts": {
    "build:staging": "env-cmd -f .env.staging npm run build",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "sitemap": "babel-node src/sitemap-generator.js"
  },
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

You just have to tell babel how to handle css file. you can include this line to your sitemap-generator.js file

require.extensions['.css'] = () => {}
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!