Skip to content
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

Sourcemaps not usable due to uglify using same filename for source and dest. #410

Open
dbruning opened this issue Nov 12, 2015 · 0 comments

Comments

@dbruning
Copy link

Hi,

Great project, has saved me a ton of time, thanks!

I ran into an issue today which I've solved & hopefully you can incorporate easily. I haven't created a PR because I'm not sure if my fix is the correct fix, but hopefully this description is enough.

My problem is that although sourcemaps were being generated, they were not being used by either Chrome, or Raygun, and there was no clear indication of why not.

Turns out the problem was that Uglify was creating a sourcemap file which had the "sources" property set to the same filename as the minified file.
This in turn is due to the uglify step in the gruntfile.js having the same filename as an input & output.

I fixed the problem locally by changing the concat:compile_js action to create a file ending with .combined.js, and then changing the "files" property of uglify:compile:files to use that as input, but outputting the plain old .js file, as below:

    files: {
      '<%= compile_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.js': '<%= concat.compile_js.dest %>'

I'm fairly new at Grunt so not sure if there's a smarter way to specify the output there. But hopefully you get my drift & make this change to get sourcemaps working for other people using tools like Raygun. (Thanks to Daniel @ Raygun for pointing me on the path to a fix for this issue).

Cheers,
Darren.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant