How do I remove comments using the RequireJS optimizer?

javascript, js-amd, optimization, requirejs, uglifyjs

Solution

You can add the following line to your build.js file used for r.js

preserveLicenseComments: false,

Here is the full documentation: https://github.com/jrburke/r.js/blob/master/build/example.build.js#L519

Problem

I am trying to remove copyright comments from my optimized script files. We are using RequireJS with the default UglifierJS. I looked into Uglifier which in itself has a flag called `-nc` or `--no-comments`, but it does not seem like RequireJS lets you set that option in the build profile. Is there anyway to do this?

Original source