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
Adding Source Map causes code to become mangled #1782
Comments
Thanks for the clear reproduction. We've repro'd the problem and will look into more. |
The problem is that this source map seems to have its mappings out of order (some of the relative generated column indices are negative). The library we use to process source maps (mozilla's library) assumes this isn't the case, and croaks. The Source Map spec is vague enough that I can't tell if this is a valid file or not. How did you actually generate this file? With Clojurescript? Looking at https://github.com/clojure/clojurescript/blob/7c7fec5c056012c4d922727596d44389972147e7/src/clj/cljs/source_map.clj#L10 it sure looks like they expect the columns to be sorted. |
Ive added a branch to the reproduction to demonstrate how I created the files: |
Hmm, I think your demonstration requires me to know a little more about ClojureScript than I do to actually play with it. But the good news is that the source-map maintainers think that your map is legitimate, and they accepted my PR to process it correctly. I'll do a new build and get this into the next release. |
Awesome, thanks. Looking forward to the changes. If you want to compile it, you have to install leiningen, and run lein cljsbuild once (or auto, if you want to keep the compilation running). If you change the project.clj file, you have to restart the leiningen process (and probably clean the build artifacts by running lein cljsbuild clean). |
Fixes #1782. This dev bundle also drops optimist from the dev bundle (previously committed, not built until now).
OK, I think this is now fixed on the sso branch. (sso should get merged to devel pretty soon; because the fix was in the dev bundle it made more sense to do it on this branch which already has dev bundle changes rather than build a new one just for devel.) Thanks for the report, and I hope you get clojurescript working with meteor! |
Thanks, Its coming along well, other than the source-map problems, I mostly need to create some clojurescript interfaces to Meteor (and externs files for meteor so that google's closure advanced compilation doesn't mangle the names). |
I have compiled some source code with only simple compression using clojurescript. This leads to a rather large source file with source maps. Using a package, I am trying to associate a source map with the source file, but when I do so, it causes the original source to become mangled, causing some random characters to be lost (unsurprisingly causing errors).
Reproduction here: https://github.com/mystor/meteor-sourcemap-bug
To reproduce, run the meteor app, and visit it on the client, you will see an error in the log, and the javascript will be malformed. If you remove the code in
packages/mypackage/plugin/compile.js
to add a source map, you will see that the code is not mangled and works fine.The text was updated successfully, but these errors were encountered: