Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev mode is not re building / reloading in monorepo context (nx) #2983

Closed
npirotte opened this issue Apr 26, 2022 · 9 comments · Fixed by #3188
Closed

Dev mode is not re building / reloading in monorepo context (nx) #2983

npirotte opened this issue Apr 26, 2022 · 9 comments · Fixed by #3188

Comments

@npirotte
Copy link

What version of Remix are you using?

1.4.1

Steps to Reproduce

  • Create a monorepo with NX (I assume it's the same with turbo repo)
  • Create a remix application
  • Create a library
  • Import something from the library into the application
  • Start the application in dev mode
  • Save some change in the library file.

Alternative that might go quicker:

Expected Behavior

App rebuild and reload.

Actual Behavior

Nothing happens, I have to do some change in the app itself to have it reloading.

@npirotte
Copy link
Author

After more testing, I understand that remix listen to events on the appDirectory, while my expectation are that it listen to appDirectory + dependencies changes (in monorepo context, most of the files will be out of appDirectory).

@npirotte
Copy link
Author

npirotte commented Apr 26, 2022

As an easy and simple solution, I can propose to add an optional configuration in the remix config:

export interface AppConfig {
  /**
  * List of extra paths or globs to watch changes on in addition to the main app directory.
  * relative to `remix.config.js`. Defaults to `[]`.
  */
  watch?: string | string[]
}

This would the be merged to the current list of watched directories:

// compiler.ts
let extraWatch = Array.isArray(config.watch) ? config.watch : [config.watch];
let toWatch = [config.appDirectory, ...extraWatch];
if (config.serverEntryPoint) {
  toWatch.push(config.serverEntryPoint);
}

@npirotte
Copy link
Author

npirotte commented Apr 26, 2022

Already created an example implementation here: #2985

@fknop
Copy link

fknop commented May 8, 2022

Having the same issue with NX. Is there an eventual workaround until the fix lands?

@npirotte
Copy link
Author

Didn't found anything yet, currently I simply keep the root.tsx file opened, and I hit save on that one when I want to rebuild the app.

@jdnichollsc
Copy link

@fknop maybe using patch-package with the changes created by @npirotte in that PR 🤔

@ctrlplusb
Copy link

ctrlplusb commented Jun 29, 2022

Would be cool if there was a webhook against the development server that could be pinged to force a rebuild. e.g. http://localhost:3000/__remix__internal__/rebuild

I could bind the necessary calls to that within my workflows.

@MichaelDeBoey
Copy link
Member

Closed by #3188

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2022

🤖 Hello there,

We just published version v0.0.0-nightly-fb3cb3a-20220701 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants