The r.js
optimizer has settings you can use to control how the minifier operates. The default minifier used is UglifyJS. The uglifyjs
option tells r.js
how to invoke it. Given the settings you've shown, removing optimize: "none"
and adding uglify: { no_mangle: true }
is what is needed:
english: {
options: {
baseUrl: "js",
mainConfigFile: "js/app-en.js",
name: "app-en",
out: "js/dist/<%= pkg.name %>-en.js",
uglify: {
no_mangle: true
},
}
}
The whole set of settings that UglifyJS takes is documented here. If you ever need or want to switch to UglifyJS2 or Closure, r.js
has uglify2
and closure
settings that you can use to set their options.
For Uglify2, the setting to prevent mangling would be:
uglify2: {
mangle: false
}
With Closure, I believe you'd want:
closure: {
CompilationLevel: 'WHITESPACE_ONLY',
},