Last active
August 29, 2015 14:15
-
-
Save bhauman/f954c4ee3611cf51494d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:optimizations :none | |
:output-dir "samples/hello/out" | |
:output-to "samples/hello/out/hello.js" | |
:source-map true} | |
Currently print-mapped-stacktrace takes a path from the root of the project. | |
(print-mapped-stacktrace | |
[{:file "samples/hello/out/hello/core.js" <-- path from project root | |
:function "first" | |
:line 2 | |
:column 1}]) | |
) | |
Some clients are getting there code from a server and thus don't have project root paths. | |
In fact the client side paths can be arbitrary in a way that is difficult and non trivial | |
for repl server code like IJavaScriptEnv's to deduce the correct project root path from. | |
For instance if a browser (figwheel) client is getting its code from localhost/arbtirary/path/to/example/core.js | |
but :output-dir is "out", how is the IJavaScriptEnv supposed to reliably calculate the | |
path from project root. | |
Because all clients can easily calculate the output-dir relative path with js/goog.basePath: | |
output-dir_relative_path ~=~ path - ( js/goog.basePath - #"goog/$") | |
I think it may be more general to take an output-dir relative path from base like so: | |
(print-mapped-stacktrace | |
[{:file "hello/core.js" <-- path from output dir | |
:function "first" | |
:line 2 | |
:column 1}])) | |
I'm solving this problem in figwheel by calculating the output-dir_relative_path client side | |
then having the IjavaScriptEnv prepend the :output-dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment