This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-21
Channels
- # announcements (10)
- # aws (10)
- # babashka (23)
- # beginners (111)
- # biff (8)
- # calva (25)
- # clj-kondo (9)
- # cljsrn (4)
- # clojure (72)
- # clojure-belgium (6)
- # clojure-europe (50)
- # clojure-germany (2)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-uk (1)
- # datahike (3)
- # emacs (10)
- # graalvm (19)
- # graphql (3)
- # juxt (7)
- # kaocha (9)
- # malli (23)
- # nbb (20)
- # pathom (17)
- # pedestal (6)
- # polylith (11)
- # portal (8)
- # remote-jobs (3)
- # shadow-cljs (18)
- # sql (3)
- # tools-deps (20)
Hi, I'm requiring a node lib in package.json thusly:
"dependencies": {
"pgsql-parser": "^13.4.0",
requiring it:
(:require
["pgsql-parser" :as pgsql]
but when I go to build my own node lib I get:
Uncaught Error: Cannot find module 'pgsql_parser'
Looking at the shim generated I see:
goog.provide("shadow.js.shim.module$pgsql_parser");
goog.provide("module$shadow_js_shim_module$pgsql_parser");
shadow.js.shim.module$pgsql_parser = require("pgsql_parser");
module$shadow_js_shim_module$pgsql_parser.default = shadow.js.shim.module$pgsql_parser;
All is well. I assume this a bug to raise, but thought I'd check if anyone has an insight because this confuses me. The Shadow code calls Closure libs to generate names.
@coltnz I don't know how that would happen? there is never any translation or conversion of -
to _
for JS packages. I cannot reproduce it locally either? which shadow-cljs version do you use?
do you maybe have a [pgsql_parser :as pgsql]
or [pgsql-parser :as pgsql]
require somewhere else in your code?
build target shouldn't matter for this. just tried with :node-script
and :node-library
. both totally fine
for shadow-cljs, for (shadow/watch :app-id), is it possible to say: you don't have to do highest level optimization, but please do a quick tree shake and output a .js that I can copy/paste elsewhere? [I'm working on a project involving both cljs and non-cljs js partts, and I'd like to copy/paste the generate .js file elsewhere]
I have a file src/foo.js . Is there a way to tell shadow-cljs, even in optimizations:advanced, to not rewrite file src/foo.js ?
no. why would that matter? if you want to prevent renaming of certain stuff add externs