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 (21)
- # clara (9)
- # cljs-dev (149)
- # cljsrn (5)
- # clojure (181)
- # clojure-austin (2)
- # clojure-dusseldorf (4)
- # clojure-italy (14)
- # clojure-norway (1)
- # clojure-russia (18)
- # clojure-spec (39)
- # clojure-uk (36)
- # clojurescript (77)
- # core-async (6)
- # data-science (23)
- # datomic (48)
- # emacs (1)
- # fulcro (3)
- # garden (4)
- # hoplon (47)
- # jobs (6)
- # jobs-rus (1)
- # leiningen (2)
- # lumo (15)
- # off-topic (8)
- # om (8)
- # onyx (39)
- # parinfer (19)
- # pedestal (7)
- # re-frame (100)
- # reagent (14)
- # ring-swagger (1)
- # sql (8)
- # yada (16)
trying out a :modules
build with the latest cljs. The good news is, it’s compiling :slightly_smiling_face:. 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’ve checked the guide and I don’t 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"
is there anything we need to manually npm-wise, before compiling with the latest cljs? eg. npm install @cljs-oss
I’ve been seeing this on every compile: TypeError('Path must be a string. Received ' + inspect(path))
ok, more generally, I’m 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’ve been getting that in both versions (854 and 908) and it hasn’t seemed to cause any problem, it’s 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 [email protected] [email protected]
and leaving it out of :npm-deps, but it should be the same with:
:npm-deps {:react "next"
:react-dom "next"}
@dnolen, ok, I am also setting something up with the jar and will try to reproduce what I’m seeing
@mhuebert ah right I didn’t get so far as ReactDOM was just trying to narrow it down to actual issue
@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
@anmonteiro I just return path.node.source
, I don’t check that it’s a string, I wonder if that’s a probem?
if the problem is in @cljs-oss/module-deps
then at least we don’t need another release :slightly_smiling_face:
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'],
});
so this solves the immediate issue, but I think we still have a problem in index-node-modules-dir
I don’t 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’m getting this error now:
Exception in thread "main" java.lang.AssertionError: Assert failed: cljs.analyzer/foreign-dep? expected symbol got "react-dom/server"
@anmonteiro ah so you’re saying just react-dom/server
0.16 definitely didn’t work before
@dnolen we’re just not saying that "react-dom/server.browser.js"
provides "react-dom/server"
will take your patch when you have it - would be nice to have some tests for these cases
@dnolen I’ll provide patches for this one and https://dev.clojure.org/jira/browse/CLJS-2326 which I found earlier today