Fork me on GitHub
#shadow-cljs
<
2024-07-17
>
p-himik13:07:57

Can you please remind me what should be done in the case of duplicate entries reported by build-report? To be specific, in my case under node_modules I have: • @sentry/core@sentry-internal/replay/node_modules/@sentry/core@sentry-internal/replay-canvas/node_modules/@sentry/core • etc. Tried removing node_modules and running npm i again - no luck.

thheller13:07:04

that means npm installs 2 separate versions. most likely because of some version conflict

thheller13:07:31

i.e. you specifying a @sentry/core versions but the @sentry-internal things wanting another

thheller13:07:33

you may specifiy :js-options {:allow-nested-packages false} to only pick top level packages and thus removing the duplicates. but that may lead to errors if they aren't actually compatible

p-himik13:07:24

God I hate NPM. Figured it was because of another package that I actually don't need anymore because of Sentry 7->8 migration path is wonky. Ran npm uninstall that-package. It removed almost everything that's actually specified in my package.json. How the hell.

alex23:07:26

I have the follow directory structure:

project-dir
- package.json
- node_modules
- app
  - package.json
  - node_modules
I have a shadow-cljs.edn build targeting the app directory. I would like app to ignore normal Node resolution for dependencies/packages and only look inside of /app/node_modules (ignoring /node_modules ). I've tried using :js-options {:js-package-dirs ["app/node_modules"]}} , but in local dev, my build still seems to resolve packages present in the root directory node_modules but missing from the app/node_modules directory. Is there a shadow-cljs way to configure this, or should I try setting the NODE_PATH env variable to restrict Node module resolution to the app directory?

Pranav Ram05:07:30

This might work?

:js-options {:js-package-dirs ["./app/node_modules"]}

thheller08:07:51

:js-options {:js-package-dirs ["app/node_modules"]}} is correct and should work, if placed properly of course. you didn't specify where you set it

thheller08:07:52

you also didn't specify which :target the build is using, as this won't have any effect for builds where shadow-cljs doesn't actually bundle anything, e.g. :node-script. here node would be responsible for resolving stuff and I don't know how you'd stop it from going "up"