Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecutionException: java.lang.AssertionError: Assert failed: (map? rc) #1

Closed
tiye opened this issue Oct 14, 2017 · 6 comments
Closed

Comments

@tiye
Copy link
Member

tiye commented Oct 14, 2017

{:source-paths ["src/"]
 :dependecies []
 :builds {:app {:output-dir "target/"
                :asset-path "."
                :target :browser
                :module-loader true
                :modules {:main {:entries [app.main]}
                          :extra {:entries [app.extra]
                                  :depends-on #{:main}}}
                :devtools {:after-loader app.main/reload!}}}}

well:

                :module-loader true
=>> yarn shadow-cljs compile app
yarn run v1.1.0
$ "/Users/chen/repo/minimal-xyz/minimal-shadow-cljs-loader/node_modules/.bin/shadow-cljs" "compile" "app"
shadow-cljs - config: /Users/chen/repo/minimal-xyz/minimal-shadow-cljs-loader/shadow-cljs.edn version: 2.0.15
shadow-cljs - starting ...
[:app] Compiling ...
[CACHED] cljs/core.cljs
[CACHED] clojure/string.cljs
[CACHED] shadow/cljs/devtools/client/console.cljs
[CACHED] app/main.cljs
[CACHED] app/extra.cljs
ExecutionException: java.lang.AssertionError: Assert failed: (map? rc)
	java.util.concurrent.FutureTask.report (FutureTask.java:122)
	java.util.concurrent.FutureTask.get (FutureTask.java:192)
	clojure.core/deref-future (core.clj:2297)
	clojure.core/future-call/reify--8099 (core.clj:6899)
	clojure.core/deref (core.clj:2317)
	clojure.core/deref (core.clj:2303)
	clojure.core/map/fn--5589 (core.clj:2750)
	clojure.lang.LazySeq.sval (LazySeq.java:40)
	clojure.lang.LazySeq.seq (LazySeq.java:49)
	clojure.lang.RT.seq (RT.java:528)
	clojure.core/seq--5125 (core.clj:137)
	clojure.core/filter/fn--5616 (core.clj:2806)
	clojure.lang.LazySeq.sval (LazySeq.java:40)
	clojure.lang.LazySeq.seq (LazySeq.java:49)
	clojure.lang.RT.seq (RT.java:528)
	clojure.core/seq--5125 (core.clj:137)
	clojure.core.protocols/seq-reduce (protocols.clj:24)
	clojure.core.protocols/fn--7837 (protocols.clj:75)
	clojure.core.protocols/fn--7837 (protocols.clj:75)
	clojure.core.protocols/fn--7783/G--7778--7796 (protocols.clj:13)
	clojure.core/reduce (core.clj:6753)
	clojure.core/into (core.clj:6820)
	clojure.core/into (core.clj:6812)
	shadow.cljs.devtools.cli/do-build-commands (cli.clj:70)
	shadow.cljs.devtools.cli/do-build-commands (cli.clj:48)
	shadow.cljs.devtools.cli/main (cli.clj:89)
	shadow.cljs.devtools.cli/main (cli.clj:74)
	clojure.core/apply (core.clj:661)
	clojure.core/apply (core.clj:652)
	shadow.cljs.devtools.cli/-main (cli.clj:132)
	shadow.cljs.devtools.cli/-main (cli.clj:130)
	clojure.lang.Var.applyTo (Var.java:702)
	clojure.core/apply (core.clj:657)
	clojure.main/main-opt (main.clj:317)
	clojure.main/main-opt (main.clj:313)
	clojure.main/main (main.clj:424)
	clojure.main/main (main.clj:387)
	clojure.lang.Var.applyTo (Var.java:702)
	clojure.main.main (main.java:37)
Caused by:
AssertionError: Assert failed: (map? rc)
	shadow.build.data/get-output! (data.clj:150)
	shadow.build.data/get-output! (data.clj:150)
	shadow.build.targets.browser/inject-loader-setup (browser.clj:134)
	shadow.build.targets.browser/inject-loader-setup (browser.clj:91)
	shadow.build.targets.browser/process (browser.clj:410)
	shadow.build.targets.browser/process (browser.clj:396)
	clojure.lang.Var.invoke (Var.java:381)
	shadow.build/process-stage (build.clj:110)
	shadow.build/process-stage (build.clj:102)
	shadow.build/compile (build.clj:272)
	shadow.build/compile (build.clj:251)
	shadow.cljs.devtools.api/compile* (api.clj:161)
	shadow.cljs.devtools.api/compile* (api.clj:157)
	shadow.cljs.devtools.cli/do-build-command (cli.clj:35)
	shadow.cljs.devtools.cli/do-build-command (cli.clj:25)
	shadow.cljs.devtools.cli/do-build-commands/fn--550/fn--551 (cli.clj:66)
	clojure.core/binding-conveyor-fn/fn--5478 (core.clj:2027)
	java.util.concurrent.FutureTask.run (FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
	java.lang.Thread.run (Thread.java:748)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
=>>
@thheller
Copy link

Should be fixed in shadow-cljs@2.0.16.

@tiye
Copy link
Member Author

tiye commented Oct 14, 2017

It's fixed.

However I think :module-hash-names true should work with :module-loader true. It was just how Webpack worked. When the files are put on CDN, we need that hash names anyway.

=>> yarn release
yarn run v1.1.0
$ shadow-cljs release app
shadow-cljs - config: /Users/chen/repo/minimal-xyz/minimal-shadow-cljs-loader/shadow-cljs.edn version: 2.0.16
shadow-cljs - starting ...
[:app] Compiling ...
[CACHED] cljs/core.cljs
[CACHED] app/extra.cljs
[CACHED] app/main.cljs
-> Closure - Optimizing ...
<- Closure - Optimizing ... (7943 ms)
:module-loader true defeats purpose of :module-hash-names
{}
ExceptionInfo: :module-loader true defeats purpose of :module-hash-names
	clojure.core/ex-info (core.clj:4744)
	clojure.core/ex-info (core.clj:4744)
	shadow.build.targets.browser/flush (browser.clj:324)
	shadow.build.targets.browser/flush (browser.clj:314)
	shadow.build.targets.browser/process (browser.clj:418)
	shadow.build.targets.browser/process (browser.clj:400)
	clojure.lang.Var.invoke (Var.java:381)
	shadow.build/process-stage (build.clj:110)
	shadow.build/process-stage (build.clj:102)
	shadow.build/flush (build.clj:298)
	shadow.build/flush (build.clj:294)
	shadow.cljs.devtools.api/release* (api.clj:198)
	shadow.cljs.devtools.api/release* (api.clj:183)
	shadow.cljs.devtools.cli/do-build-command (cli.clj:29)
	shadow.cljs.devtools.cli/do-build-command (cli.clj:25)
	shadow.cljs.devtools.cli/do-build-commands/fn--550/fn--551 (cli.clj:66)
	clojure.core/binding-conveyor-fn/fn--5478 (core.clj:2027)
	java.util.concurrent.FutureTask.run (FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
	java.lang.Thread.run (Thread.java:748)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@thheller
Copy link

I did not allow this on purpose since I'm not quite sure what the best solution to this is.

The issue is that the loader needs a tiny bit of data to work. It needs to know the filenames of each module. If those filenames are hashed they themselves change the hash of the default module which includes the loader. Since the purpose of :module-hash-namesis to allow proper caching this does not make much sense since any change will always cause the hash of the default module to change, ie. no cache.

So to not have this limitation there needs to be a way to configure the loader without modifying the loader file. I don't think webpack handles this case at all?

One solution would be to create a loader.json file that can be loaded on startup or included in the HTML directly. I just didn't put any work into this yet since I do not use the :module-loader myself.

I can remove the strict check but really would prefer to fix this properly. You might as well run without :module-hash-names until this issue is solved.

@tiye
Copy link
Member Author

tiye commented Oct 15, 2017

Not very sure about "default module".. If that refers to main.cljs I would yes it changes every time there code updates. And since main.cljs contains the hash of extra.cljs, the hash of main.cljs also based on extra.cljs. I think Webpack works in such way(Need to confirm though).

I'm not using :module-loader either currently...

@thheller
Copy link

Using :module-loader should work, just as :module-hash-names works. Using them in combination just isn't allowed at the moment. I can allow it but again whats the point then.

The "default" module always refers to the module that is going to be loaded first. Most of the time this includes cljs.core and things like the shadow.loader. This makes it one of the "larger" modules but also one of the modules that should change very infrequently. Injecting the loader setup with hashed names however changes it with every build which totally removes any benefit of :module-hash-names.

Last time I checked webpack still had a whole lot of problems regarding caching and is quite challenging to get that working properly.

Could maybe just download the manifest.json on startup as well since that contains all the necessary info. Don't want to rush this ... just use :module-loader without :module-hash-names and you'll be fine for now.

@tiye
Copy link
Member Author

tiye commented Oct 15, 2017

That's a really huge issue of Webpack... I has no idea now...

However I think the hash of default module is still necessary since files on CDN sometimes are regarded as "expires in 10 years". If the a file changed, it's name should change.

@tiye tiye closed this as completed Oct 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants