question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[To be documented] React-static fails to start if rebuildRoutes() is put into static.config.js

See original GitHub issue
yarn start
yarn run v1.22.4
$ react-static start
Starting Development Server...
  Error: Routes cannot be rebuilt yet!
  
  - getRoutes.js:12 Function.current
    [rs-md]/[react-static]/src/static/getRoutes.js:12:9
  
  - getRoutes.js:8 rebuildRoutes
    [rs-md]/[react-static]/src/static/getRoutes.js:8:17
  
  - static.config.js:7 Object.<anonymous>
    /home/kanyck/sites/rs-md/static.config.js:7:1
  
  - loader.js:1158 Module._compile
    internal/modules/cjs/loader.js:1158:30
... and so on...

The same with chokidar:

yarn start
yarn run v1.22.4
$ react-static start
Starting Development Server...
Fetching Site Data...
[✓] Site Data Downloaded
/home/kanyck/sites/rs-md/node_modules/react-static/lib/static/getRoutes.js:40
  throw new Error('Routes cannot be rebuilt yet!');
  ^

Error: Routes cannot be rebuilt yet!
    at Function.current (/home/kanyck/sites/rs-md/node_modules/react-static/src/static/getRoutes.js:12:9)
    at rebuildRoutes (/home/kanyck/sites/rs-md/node_modules/react-static/src/static/getRoutes.js:8:17)
    at FSWatcher.<anonymous> (/home/kanyck/sites/rs-md/static.config.js:6:45)
    at FSWatcher.emit (events.js:311:20)
    at FSWatcher.<anonymous> (/home/kanyck/sites/rs-md/node_modules/chokidar/index.js:200:38)
    at FSWatcher._emit (/home/kanyck/sites/rs-md/node_modules/chokidar/index.js:241:5)
    at FSWatcher.NodeFsHandler._handleDir (/home/kanyck/sites/rs-md/node_modules/chokidar/lib/nodefs-handler.js:340:49)
    at FSWatcher.<anonymous> (/home/kanyck/sites/rs-md/node_modules/chokidar/lib/nodefs-handler.js:462:19)
    at FSWatcher.<anonymous> (/home/kanyck/sites/rs-md/node_modules/chokidar/lib/nodefs-handler.js:467:16)
    at FSReqCallback.oncomplete (fs.js:167:5)

react-static v7.2.3

Steps to Reproduce the problem

  1. enable rebuildRoutes as described in api.md
  2. run yarn start

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kanyckcommented, Apr 14, 2020

Not right now… Would have to find out how to PR, that would demand much more than 5 min (and switching the context). Sorry for that. I promise I’ll learn how to do that as soon as I have a spare hour))) BTW, is there a way to remove a bug label? It’s actually not a bug but docs kludge…

1reaction
kanyckcommented, Apr 14, 2020

Yep! That works. I think this example should get into the docs, otherwise it’s quite confusing… Closing…

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-static/config.md at master - GitHub
A static.config.js file is optional, but recommended at your project root to use react-static to its fullest potential. If present, it must default...
Read more >
How to render the menu from the routes defined at static ...
Following the official guide, it should be something simple like this: //App.js import React from 'react' import { useRouteData } from ...
Read more >
react-static | Yarn - Package Manager
In your static.config.js : Replace all instances of getProps with getData; Replace getSiteProps with getSiteData; If you are using a custom Document be...
Read more >
Deploy a Create React App Static Site - Render
Deploy a Create React App static site on Render in just a few clicks. Served over a lightning-fast global CDN with fully managed...
Read more >
react-static-plugin-preact - npm
Start using react-static-plugin-preact in your project by running `npm i ... Then add the plugin to your static.config.js :.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found