This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-30
Channels
- # aws (4)
- # beginners (143)
- # boot (37)
- # cider (31)
- # cljs-dev (53)
- # clojure (303)
- # clojure-conj (5)
- # clojure-dev (106)
- # clojure-dusseldorf (2)
- # clojure-greece (3)
- # clojure-italy (23)
- # clojure-spec (83)
- # clojure-uk (7)
- # clojurescript (328)
- # core-async (25)
- # cursive (2)
- # datascript (2)
- # datomic (3)
- # emacs (10)
- # hoplon (1)
- # jobs (2)
- # lein-figwheel (1)
- # leiningen (13)
- # luminus (6)
- # off-topic (38)
- # onyx (2)
- # parinfer (13)
- # pedestal (2)
- # portkey (5)
- # re-frame (11)
- # reagent (2)
- # shadow-cljs (61)
- # specter (6)
- # unrepl (60)
- # vim (4)
@juhoteperi https://github.com/clojure/clojurescript/commit/9c1c727674aa7e2bfb399289d6f00bd51745457a
I’m realizing that the work we did modules should probably always be true if your :target
is Node.js
Looks like this is the bad guy: https://gist.github.com/Jannis/fc1af47700279a3054ff1ca047b8fa7a
@jannis :pseudo-names
true is your friend when debugging anything related to :advanced
Uncaught TypeError: (0 , $_ponyfill2$$module$Users$jannis$Work$oss$jannis$groom$node_modules$symbol_observable$lib$index$$.default) is not a function
. I think https://gist.github.com/Jannis/fc1af47700279a3054ff1ca047b8fa7a (original and compiled filles) should give me enough to debug some.
@jannis this might be an issue related to how closure rewrites babel processed ES6 files
yep, https://gist.github.com/Jannis/fc1af47700279a3054ff1ca047b8fa7a#file-original-index-js-L3-L5
this does not work since the file was rewritten by babel and Closure processes this thinking it is CommonJS
basically closure would need to detect/support the __esModule
idiom for this to work
That makes sense. Two questions: What makes Closure think it’s CommonJS? And is there a workaround?
module$Users$jannis$Work$oss$groom$node_modules$symbol_observable$lib$index["default"]["default"]
this is the issue
workaround not that I'm aware of. well .. what I'm doing in shadow-cljs but thats really an entirely different implementation
@thheller Do you have a good rep with the Closure team? I wouldn’t be comfortable filing an issue with my half-knowledge but I’d be happy to work on a fix.
not really. this was the first thing I ever reported there https://github.com/google/closure-compiler/issues/2822
the "fix" however would be pretty involved I think. goes deeply into their rewriting code and ES6/CJS interop which is already pretty tricky as it is
Right. I wonder if there’s a better chance to change either apollo-client (which does the import Thing from "symbol-observable"
) or symbol-observable to prevent this…
so probably symbol-observable adding "module"
to there package.json
and adding the sources
Hehe, that would be nice–but I can’t use "module"
because it breaks requiring graphql-js (which has an .mjs
file in its "module"
entry and was the reason for the new :package-json-resolution
option).
Ok, that makes other npm deps pick up ES6 sources as well and apparently, Closure doesn’t support wildcard exports yet:
ERROR - ES6 transpilation of 'Wildcard export' is not yet implemented.
export*from"./link";
^^^^^^^^^^^^^^^^^^^^
...
ERROR: JSC_CANNOT_CONVERT_YET. ES6 transpilation of 'Wildcard export' is not yet implemented.
They are working on it: https://github.com/google/closure-compiler/issues/878
well in shadow-cljs I added the ability to override how to resolve things. https://shadow-cljs.github.io/docs/UsersGuide.html#_resolving_packages
so you could add :resolve {"symbol-observable" {:target :npm :require "symbol-ovservable/path/to/es-main"}}
nothing comparable in Core yet but it has been extremely valuable for a lot of issues in the npm world so it might be worth considering something like this for core
Maybe. It’s a bit like a per-dependency :package-json-resolution
option except a little more flexible. I wonder if it would work at all in core though, with us relying on resolving modules the same way Closure does.
right ... its probably not so easy to add this since I also rewrite code before passing it to Closure