Closed jbellis closed 2 years ago
Thanks for the detailed report. It's helpful.
There is something fishy here. I see that it is trying to use debug loader but it shouldn't (which is slow and has bunch of problems). By any chance you have a custom setup? Your repro also uses custom setup so it is not surprising that one is using the debug loader.
To check this with your repro, could you follow the instructions in https://github.com/google/j2cl/blob/master/docs/getting-started.md instead of custom html page?
with bazel run src/main/java/com/google/j2cl/samples/helloworld:helloworld_dev_server
, I get Uncaught Error: java.lang.RuntimeException: rte
as desired.
What is the correct way to use j2cl with a custom setup?
Please see j2cl_application.bzl documentation for providing/using custom host page for the dev server.
If you need use your own server, you can try to replicate those instructions (link importing <target>_dev.html
) or you can manually load <target>_dev_config.js
in addition to <target>_dev.js
in your page.
Confirmed that adding helloworld_dev_config.js to my page fixes the problem. Thank you!
Where would it be appropriate to mention this in the docs?
I think it depends on where you have found out about the <target>_dev.js
. I think it is only documented in j2cl_application
so we can improve the documentation there.
Ahh! The target in helloworld mentions it in the section starting with "It provides couple of convenient targets"
I think we should remove the mention of dev.js and point the right place (even it is not complete). I will send a patch.
Thank you!
With the dev bundle, uncaught exceptions result in a stack trace like this:
Notably, all the information about the exception that caused this is lost -- it dies trying to load java.lang.Exception before it can show anything.
With the non-dev bundle it works as expected and I get
Ideally the dev bundle would do the same, only preserving type names.
I copied helloworld_dev_js.map into my html directory as well, but it is looking for HelloWorld.js.map instead which is not an artifact present in bazel-bin.
Here is my modification of the hello world example to throw a RuntimeException. To run it, I copied helloworld_dev.js and helloworld_dev_js.map into the html directory but I did not commit them. I note that it is looking for HelloWorld.js.map but that is not an artifact present in bazel-bin.