shadow-cljs

lsenjov 2025-06-11T05:19:34.617129Z

Is there a way to tell shadow to not include a file/flick browser on? The library https://www.npmjs.com/package/object-inspect has a clause in the package.json

"browser": {
    "./util.inspect.js": false
  },
This file is loaded as shadow is running with browser mode off, but util.inspect.js fails to work correctly in browser (it's designed for node environments). Importing the util polyfil is doable, but not nice to fix a file that shouldn't be running. I don't think the :npm resolve is usable here, since it's part of the object-inspect package.

lsenjov 2025-06-11T05:32:14.121839Z

Entry keys doesn't seem to have an easy way to make things work like I thought it might

thheller 2025-06-11T06:00:58.636009Z

kinda unclear what you are asking here as your description is a bit confusing. seems like a bug in the library if the file it specifies to use for browsers doesn't work in a browser?

thheller 2025-06-11T06:02:36.381279Z

ah nvm. read it wrong. the false there should work just fine in shadow-cljs? I mean it should be ignoring the file for :target :browser

thheller 2025-06-11T06:07:04.719509Z

works as expected for me, no extra config whatsoever, just the defaults

lsenjov 2025-06-11T06:17:04.713509Z

I'm getting this compilation error:

The required JS dependency "util" is not available, it was required by "node_modules/object-inspect/util.inspect.js".

Dependency Trace:
	cubiko/app/container/cubiko/conditional_test.cljs
	cubiko/test/utils/component_utils.cljs
	node_modules/@testing-library/react/dist/index.js
	node_modules/@testing-library/react/dist/pure.js
	node_modules/@testing-library/dom/dist/index.js
	node_modules/@testing-library/dom/dist/get-queries-for-element.js
	node_modules/@testing-library/dom/dist/queries/index.js
	node_modules/@testing-library/dom/dist/queries/label-text.js
	node_modules/@testing-library/dom/dist/queries/all-utils.js
	node_modules/@testing-library/dom/dist/query-helpers.js
	node_modules/@testing-library/dom/dist/suggestions.js
	node_modules/@testing-library/dom/dist/role-helpers.js
	node_modules/aria-query/lib/index.js
	node_modules/aria-query/lib/elementRoleMap.js
	node_modules/deep-equal/index.js
	node_modules/es-get-iterator/index.js
	node_modules/stop-iteration-iterator/index.js
	node_modules/internal-slot/index.js
	node_modules/side-channel/index.js
	node_modules/object-inspect/index.js
	node_modules/object-inspect/util.inspect.js

Searched for npm packages in:
	/home/.../project/node_modules

See: 

thheller 2025-06-11T06:19:23.385729Z

what is your shadow-cljs version and build config?

lsenjov 2025-06-11T06:24:44.220069Z

thheller/shadow-cljs {:mvn/version "3.1.5"}

:npm-deps {:install false}
:build-defaults {:compiler-options {:warnings-as-errors true}}
:builds {
    :browser-test {:ns-regexp "(-test$)|(-cards$)"
                   :target :browser-test
                   :test-dir "test_runner/browser"
                   :compiler-options {:static-fns false}}}
:deps true

thheller 2025-06-11T06:31:35.611099Z

which object-inspect version? maybe an older one that doesn't have the browser override? or did you take that from your actual file on your actual disk? not npm or some github repo?

thheller 2025-06-11T06:32:10.679679Z

I'm guessing blindly. It works fine for me and not sure why it wouldn't

lsenjov 2025-06-11T06:34:55.063669Z

Npm import. I'll strip it to bare bones tomorrow and see if I can repro it better

thheller 2025-06-11T06:36:01.456419Z

hmm nevermind. it works because I still have the util polyfill installed 😛

😄 1
thheller 2025-06-11T06:36:05.481399Z

let me check

thheller 2025-06-11T06:45:53.753299Z

doh ... found it

thheller 2025-06-11T06:58:59.596529Z

ok should be fine in 3.1.6

🚀 2
lsenjov 2025-06-11T06:59:26.862849Z

You're amazing! Thank you so much!