-
Notifications
You must be signed in to change notification settings - Fork 152
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
ngAnnotate mangles sourcemaps #212
Comments
As long as you're ready to maintain the code (i.e. fix problems with it) I'd love to get further sourcemap improvements into ng-annotate so hack away! :-) |
Sure, I can do that. I'll see what I can work up. |
👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ngAnnotate sourcemaps are generally bad citizens that tend to expose the buggiest side of sourcemap implementations especially when they are one of many source mapping steps which need to be combined into a single map definitive map.
The reason is that ngAnnotate tokenizes the code and then emits a mapping for every token. When other upstream transformations generate mappings that are less granular than ngAnnotate's all hell breaks loose. I've crashed sourcemap debuggers with the results and seen dev tools do the wildest things.
The solution is simple, emit only line mappings when at all possible, like such:
Maps to ->
line 1 pos 0 maps to line 1 pos 0
line 2 pos 4 maps to line 2 pos 4
line 3 pos 0 maps to line 3 pos 0
line 5 pos 0 maps to line 4 pos 0
In my testing output like the above works great. I have a patch that does the above, but mine assumes that it will always be using $inject and never creating an inline injection parameter. I'd be willing to help get it right for both cases, but I'd like to be sure there's interest first.
The text was updated successfully, but these errors were encountered: