Skip to content

Instantly share code, notes, and snippets.

@bhauman
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhauman/f954c4ee3611cf51494d to your computer and use it in GitHub Desktop.
Save bhauman/f954c4ee3611cf51494d to your computer and use it in GitHub Desktop.
{: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