How to use grunt-UglifyJS and source code?

I am trying to get sourcemaps to play well while I use the Grunt task and UglifyJS Grunt.

Here is the current task:

uglify: { dist: { options: { sourceMap: function(path) { return path + ".map"; }, }, files: { 'dist/video.min.js': [ 'javascripts/video.js' ] } } } 

What is the problem?

The source map is generated, but Chrome is looking for the source map in the wrong place (i.e. dist/dist/video.min.js.map ). I know this because I get 404 in the console.

So, I edited dist/video.min.js and changed sourceMappingURL to point to the correct location. Now the original map is loaded, but it is looking for the .js video in a completely wrong place: dist/javascripts/video.js (this again!)

So, basically, now I am not aware of any ideas, just not digging out the grunt file.

Any ideas? Thanks!

+6
source share
1 answer

It seems that http://github.com/gruntjs/grunt-contrib-uglify/issues/71 is a potential fix.

Bummer, I always find a solution after I put SO. This place is magical!

+8
source

Source: https://habr.com/ru/post/951050/


All Articles