dune
dune copied to clipboard
Melange: moving modules inside a library with include_subdirs leads to broken paths
trafficstars
Expected Behavior
Inside a library using include_subdirs unqualified, a module X can be moved from one folder to another, with Dune re-running melc on the dependents of X so that their paths to JS imports can be updated.
Actual Behavior
Moving the module X leaves the dependents untouched, so any bundler like Webpack or Esbuild will fail because the import path to X these dependents are using still points to the old folder path.
Reproduction
- PR with a reproducing test: #9189.
For the record, we observed this behavior is quite tricky to work around once one runs into it, because it's not only necessary to run dune clean, but also remove the Dune cache if it is enabled, in order for the new paths to be picked up.