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

feat: full reload when a boundary file was wrongly imported #11

Merged
merged 6 commits into from
Nov 23, 2024

Conversation

Julien-R44
Copy link
Owner

@Julien-R44 Julien-R44 commented Oct 28, 2024

See original PR #10


Earlier, with this release https://github.com/Julien-R44/hot-hook/releases/tag/hot-hook%400.3.0 we were just throwing and thus killing the app when a boundary file was not dynamically imported because it prevented hot-hook from hot-reloading.

Now, we no longer throw the error by default, we simply emit a message of type "hot-hook:full-reload" to the parent process, which will be responsible for restarting the entire app. This "hot-hook:full-reload" message is not new, it was already used for files that should trigger a full reload so you shouldn't need to add anything to your app to support this new feature.

If you still want to throw the error, then you can pass the throwWhenBoundariesAreNotDynamicallyImported option to true, when you call hot.init or in your package.json:

{
  "hotHook": {
    "throwWhenBoundariesAreNotDynamicallyImported": true
  }
}

@RomainLanz I made this PR that completes what was missing. We'll just have to update @adonisjs/assembler to get a more specific warning. As I've done here for @hot-hook/runner, which works like the Adonis dev server

@marcuspoehls
Copy link

I’m encountering the same issue when using a base controller that I’m sharing with other controllers. The base controller provides shared methods that I’m using in the action controllers. I can’t use a base controller that is located within a boundary directory because hot-hook stops the dev server. Everything works fine if I put the base controller outside the boundaries (aka outside the "controllers" directory)

Error: The import "./user-base-controller.js" is not imported dynamically from app/controllers/auth/handle-user-signup-controller.ts

@Julien-R44 Julien-R44 merged commit 0ab1205 into main Nov 23, 2024
12 checks passed
@Julien-R44 Julien-R44 deleted the refactor/throw branch November 23, 2024 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants