Skip to content

Conversation

@kerwanp
Copy link
Contributor

@kerwanp kerwanp commented Dec 16, 2025

Problem

As of today the DynamicImportChecker will look for an import with a specific specifier (the module specifier) meaning that imports using a dynamic value as specifier are not considered dynamic.

In the following example we are dynamically importing the modules present in the ./app/controllers folder. But they are not marked as dynamically imported by hot-hook.

  const paths = await globby("./app/controllers", {
      absolute: true,
      expandDirectories: {
        extensions: ['ts', 'js', 'jsx'],
      },
    })

   for (const path of pathes) {
     await import(path)
   }

Solution

We should consider the dependency graph as a source of truth meaning that if we do not find any import for a given specifier in the parent we can consider that it is imported with a dynamic value.

BTW

I also fixed an issue where hot-hook would fail when deleting a file. As realpath resolves the full canonical path by following symlinks it throws an ENOENT when the file does no exist.

@Julien-R44 Julien-R44 merged commit 2d0b2e1 into Julien-R44:main Dec 17, 2025
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.

2 participants