hashicorp/next-remote-watch

next official support

Closed this issue · 4 comments

Can you provide more context here? This is not an actionable issue.

There are lots of examples in the link I added
It is quite straight forward...
Many cheatsheets, e.g https://github.com/vercel/next.js/blob/canary/examples/custom-server-express/server.js
Then you can use something like nodemon to run a dev server and you are all set

How does this relate to the functionality of this library? Those are docs for running a custom node server around a next app. This library specifically handles running a custom dev server which watches for changed files and reloads the browser.

Do you have a specific suggestion on something for next-remote-watch?

I saw https://github.com/hashicorp/next-remote-watch#important-warnings-and-caveats

This package utilizes undocumented APIs from next.js...

Using nodemon with a custom server and the following config should be stable as it doesn't use next internals.

nodemon.config.json
{
    "ignore": [
        ".next"
    ],
    "watch": [
        ".",
       "/path/to/what/ever"
    ],
    "ext": "js mjs cjs json ts jsx tsx"
}

In case you need to watch a symlink you need to override ignoreRoot so nodemon can watch node_modules

nodemon --config nodemon.config.json customServer.js

Another approach I saw on SO suggested using fs.utimes to trigger next to reload

// on change trigger next reload
fs.utimes('./package.json', new Date(), new Date());

I wanted to use this repo in a repo I maintain but because what is stated in the README I had to back off.