I'm using webpack with webpack.optimize.UglifyJsPlugin on an Angular app, I'd like to use this syntax to define controller:
// in header.controller.js
class HeaderController {...}
export default HeaderController;
// in app.js
import HeaderController from './header.controller'
angular.module('app', [])
.controller(HeaderController.name, HeaderController);
However, I found uglify will change the class name, how to disable this?
Assuming you're transpiling using babel. IIRC they transpile classes into functions. Have you tried using --keep-fnames?
@fabiosantoscode I tried with
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
keep_fnames: true
}
})
and
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
mangle: {
keep_fnames: true
}
})
both not work
We are not the authors of webpack. You should ask then your question.