Search code examples
javascriptgruntjsuglifyjs

Grunt uglify 0.5 not writing source map?


So Im trying to add source maps to my js project. Im using a very simple uglify command, but every time I run the task, I get an error. Im using uglify 0.5

I have pasted the error and the uglify task below. It minifies and outputs the file just fine. It just will not make the source map. Any help is appreciated.

warning: Unable to write "public/dev/output.min.js.map" file (Error code: undefined). Use --force to continue.

 uglify: {
  dev: {
    options: {
    sourceMap: true
  },
  files: {
    'public/dev/output.min.js': ['*/js/angular/angular.js']
  }
  }
}

Thanks in advance.


Solution

  • In the github issue mentioned above, it points to a bug in source-map v 0.1.35. For a temporary work around, I force the version of source-map in my package.json file by including it like this:

    "devDependencies": {
        "source-map":"0.1.34",
        ...
        "grunt-contrib-uglify": "~0.4.0",
        ...
    }