squint-cljs / compiler-common

Common code for squint and cherry
14 stars 3 forks source link

path error requiring macro #9

Open alidcast opened 1 year ago

alidcast commented 1 year ago

Can be seeing running React example npx cherry run react/index.cljs

Seems to trip up when handling the local import (:require-macros ["./macros.mjs" :refer [$]])

[cherry] Running react/index.cljs
node:internal/errors:477
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received null

I'm not sure what the status of macros are, but I was giving them a go before trying to import a library that used them, and ran into above issue.

borkdude commented 1 year ago

Macros are currently running in SCI and should be required like so:

(:require-macros [macros :refer [$]])

The macros.cljc file should be in src/macros.cljc.

You may have gotten the example from an old version of cherry, where you could import .mjs but this is no longer the case since cherry works on both the JVM and JS so code has to run in the host and this is currently done using SCI.

Could you tell me where you found the other example, so we can update it?

alidcast commented 1 year ago

https://github.com/squint-cljs/compiler-common/tree/main/cherry/examples/react

alidcast commented 1 year ago

does this relate to issue about loading namespaces/deps? https://github.com/squint-cljs/cherry/issues/64

borkdude commented 1 year ago

This example should be updated. I'll keep this issue open so I can do that.