This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-17
Channels
- # arachne (1)
- # beginners (42)
- # boot (4)
- # cider (28)
- # clara (9)
- # cljs-dev (149)
- # cljsrn (5)
- # clojure (185)
- # clojure-austin (2)
- # clojure-dusseldorf (4)
- # clojure-italy (14)
- # clojure-norway (1)
- # clojure-russia (18)
- # clojure-spec (35)
- # clojure-uk (36)
- # clojurescript (78)
- # core-async (6)
- # data-science (20)
- # datomic (48)
- # emacs (1)
- # fulcro (2)
- # garden (4)
- # hoplon (47)
- # jobs (5)
- # jobs-rus (1)
- # leiningen (2)
- # lumo (12)
- # off-topic (8)
- # om (8)
- # onyx (39)
- # parinfer (19)
- # re-frame (100)
- # reagent (15)
- # ring-swagger (1)
- # sql (8)
- # vim (1)
- # yada (20)
trying out a :modules
build with the latest cljs. The good news is, it鈥檚 compiling 馃檪. But something seems amiss: it is creating a file, <project root>/target/cljsbuild-main.js
, in addition to the modules I specified. which are appearing correctly in the output-dir, <project root>/resources/public/js/compiled
. I鈥檝e checked the guide and I don鈥檛 see any new instructions - is there a way to specify where this cljsbuild-main
file goes?
:modules
{:live-frame {:entries #{maria.frames.live-frame}
:output-to "resources/public/js/compiled/live.js"}
:trusted-frame {:entries #{maria.frames.trusted-frame}
:output-to "resources/public/js/compiled/trusted.js"}}
:output-dir "resources/public/js/compiled/out-modules-dev"
@mhuebert what is cljsbuild-main
?
are you using lein-cljsbuild
?
might just be a tooling issue
@anmonteiro that is an excellent question
I would try compiling with a naive build script
also, are you using a :main
entry in your compiler opts?
because you shouldn鈥檛
@juhoteperi this is actually a good question for boot-cljs
too
it shouldn鈥檛 create its main namespace if :modules
is specified
does it know how to handle that?
@mhuebert so you鈥檙e using lein-cljsbuild
?
@anmonteiro yeah, i will try with a build script
@anmonteiro my bad, I was on 1.1.6 and this was an issue fixed in 1.1.7
awesome
glad it鈥檚 figured out!
is there anything we need to manually npm-wise, before compiling with the latest cljs? eg. npm install @cljs-oss
@mhuebert not if you specify :npm-deps
and :install-deps true
nothing manual
I鈥檝e been seeing this on every compile: TypeError('Path must be a string. Received ' + inspect(path))
this is probably related to advanced browser
field usage
@mhuebert what module is that
react-dom
?
ok, more generally, I鈥檓 using my old (non-:modules) build now just to be consistent, and after upgrading to 1.9.908, my references to react have broken - eg. this expression, (.-prototype react/Component)
, generates Uncaught TypeError: Cannot read property 'Component' of undefined
, where in that namespace I have (ns .. (:require .. react react-dom))
I can try to put together a minimal example but before that, is there anything that should have changed the way this is to be used?
re: the earlier discussion about that warning with server.js
and server.browser.js
, I鈥檝e been getting that in both versions (854 and 908) and it hasn鈥檛 seemed to cause any problem, it鈥檚 just always logged on compile
React 16 compiles in a reasonable amount of time as an npm dep (15.* was much slower)
so previously I was just separately running npm install react@next react-dom@next
and leaving it out of :npm-deps, but it should be the same with:
:npm-deps {:react "next"
:react-dom "next"}
the problem is react-dom
@dnolen, ok, I am also setting something up with the jar and will try to reproduce what I鈥檓 seeing
and looks related to the browser field
I can repro here
@mhuebert ah right I didn鈥檛 get so far as ReactDOM was just trying to narrow it down to actual issue
might be related to how we resolve things now
^ in module_deps.js
@anmonteiro are you reproducing the warning that I posted a snippet of, or the problem here: https://clojurians.slack.com/archives/C07UQ678E/p1502993363000129
this is the problem:
path.js:28
throw new TypeError('Path must be a string. Received ' + inspect(path));
^
TypeError: Path must be a string. Received { './server.js': './server.browser.js' }
@mhuebert not interested in anything else right now. Pretty sure when this is fixed everything else will work
@dnolen react-dom/render
for example
@anmonteiro I just return path.node.source
, I don鈥檛 check that it鈥檚 a string, I wonder if that鈥檚 a probem?
checking
@dnolen I don鈥檛 know if the problem would be in Konan
my repro was against master
@anmonteiro nope unrelated to konan logic
@dnolen I think I know what鈥檚 wrong
and my fault too 馃檪
let me confirm, 1 sec
if the problem is in @cljs-oss/module-deps
then at least we don鈥檛 need another release 馃檪
it鈥檚 not unfortunately
I fixed the immediate bug but getting another one
@dnolen add aliasFields: ['browser'],
to the resolver config
around line 64
in module_deps.js
yeah that works
and removing 'browser'
from mainFields
@dnolen I can put together a patch, there鈥檚 another wrinkle to be taken care of
^ that鈥檚 how they use it in the tests
the wrinkle is we only wanna set this if target === 'nodejs'
I can paste a diff here
diff --git a/src/main/cljs/cljs/module_deps.js b/src/main/cljs/cljs/module_deps.js
index f7aa5fa0..dc5cf17b 100644
--- a/src/main/cljs/cljs/module_deps.js
+++ b/src/main/cljs/cljs/module_deps.js
@@ -8,8 +8,9 @@ let enhancedResolve = require('enhanced-resolve');
let target = 'CLJS_TARGET';
let filename = fs.realpathSync(path.resolve(__dirname, 'JS_FILE'));
-let mainFields =
- target === 'nodejs' ? ['module', 'main'] : ['module', 'browser', 'main'];
+let mainFields = ['module', 'main'];
+let aliasFields =
+ target === 'nodejs' ? [] : ['browser'];
//
let getDeps = function (src, {dynamicImport = true, parse = {sourceType: 'module', plugins: '*'}} = {}) {
@@ -61,6 +62,7 @@ let resolver = enhancedResolve.create({
),
extensions: ['.js', '.json'],
mainFields: mainFields,
+ aliasFields: aliasFields,
moduleExtensions: ['.js', '.json'],
});
this is what I have
but it doesn鈥檛 seem to fix everything
@dnolen sorry edited
copy again please
@anmonteiro only change is not inlining mainFields
why does that matter?
because we use it below
in the for
loop
so this solves the immediate issue, but I think we still have a problem in index-node-modules-dir
I don鈥檛 have time to look at it right now but I can fix it until the end of the day
basically we need to know that react-dom/server
is provided by react-dom/server.browser.js
I鈥檓 getting this error now:
Exception in thread "main" java.lang.AssertionError: Assert failed: cljs.analyzer/foreign-dep? expected symbol got "react-dom/server"
we never supported this
React probably changed
right
not react-dom/server
probably
@anmonteiro ah so you鈥檙e saying just react-dom/server
0.16 definitely didn鈥檛 work before
I think so
@anmonteiro 15.6.1 doesn鈥檛 work anymore
works for me?
@dnolen we鈥檙e just not saying that "react-dom/server.browser.js"
provides "react-dom/server"
we should do this in module_deps.js
I鈥檓 at work right now but I鈥檒l fix later
@anmonteiro I pushed the other module_deps.js
fix to master
will take your patch when you have it - would be nice to have some tests for these cases
yeah I鈥檒l definitely add tests
@dnolen I鈥檒l provide patches for this one and https://dev.clojure.org/jira/browse/CLJS-2326 which I found earlier today
I鈥檒l open an issue so I don鈥檛 forget later
assigned both CLJS-2326 and CLJS-2327 to me
will fix later