rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

Missing dependency in search path when using dynamic import

Open benadamstyles opened this issue 3 weeks ago • 5 comments

As soon as I use Js.import() I get this error:

Missing dependency X in search path.

where X is Js.import(X.make) (following the lazy component docs).

Full minimal repro here: https://github.com/benadamstyles/rescript-js-import-repro.

Short forum discussion here.

benadamstyles avatar Dec 01 '25 12:12 benadamstyles

Observation: The issue seems related to that there are 2 package specs. If you remove the bottom one (the one without in-source: true) then it works fine.

zth avatar Dec 01 '25 13:12 zth

Seems to be the exact combination of one with and one without in-source: true that's causing the issue. No other combination triggers it for me.

EDIT: v12 and Rewatch has the same issue.

zth avatar Dec 01 '25 13:12 zth

@benadamstyles could you clarify why you have that combination in package-specs?

zth avatar Dec 01 '25 13:12 zth

Oh nice catch, thanks. We need this combination because we use one codebase to generate both a Vite-based web app, and a Node/Express server. The former needs in-source for various reasons, and the latter needs to go into the lib folder for easy packaging/dockerizing.

benadamstyles avatar Dec 01 '25 13:12 benadamstyles

Just to update you, we rejigged our build process to remove the second package-spec, and now the error is gone 🎉 Might still be worth fixing though for future users?

benadamstyles avatar Dec 05 '25 10:12 benadamstyles