Glitch + Next.js issues: double-compilation

Hey all, I’ve been wrestling with this project trying to get Glitch working with next.js (and

I’ve got things working pretty well at this point, the only problem is that when you edit your code, it appears to compile things twice, making the compilation time pretty long.

Reproduction steps:
Remix my project. Open the Logs. Open the live preview. Change the code. Observe two build cycles in the logs.

If anyone can help me figure out why this is happening, it’s much appreciated!

hi! i hadn’t updated nextjs in like 10 months and updated my app after seeing this - i don’t get the double build anymore. i would run enable-pnpm in the console since we’ve implemented that as an alternative to npm install, and follow the npm scripts that i have now from the latest nextjs docs, and then build on from there with your new packages.

1 Like

heya, thanks for the reply! looks like the updated app runs into a problem i experienced, which is that when you update the content in index.js, that update is not reflected in the page render - my assumption is that it’s cached or static somewhere?

Hi @webrender,

try to replace the start script in package.json with next dev. Let me know if it works now :slight_smile:

EDIT: probably the project also need a couple additional changes. Try also adding a file called watch.json with this content:

  "install": {
    "include": [
    "exclude": []
  "restart": {
    "include": [
    "exclude": []
  "noSavedEvents": true

This tells Glitch to not restart the next server after an edit, so that next dev can recompile your changes more quickly, and also refresh the webpage for you :slight_smile:

This works great now, thank you for the assistance!