-
Notifications
You must be signed in to change notification settings - Fork 1k
How to turn off Mangle? (keep_fnames: true) #407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We haven't provided a simple way to adjust the configuration options of the UglifyJS plugin, however, you can achieve the objective by replacing the Microsoft-provided plugin with your own. Here is an example: build.configureWebpack.setConfig({
additionalConfiguration: (config) => {
var webpack = require('webpack');
// Remove the Microsoft-provided Uglify plugin
config.plugins.forEach((plugin) => {
if (plugin instanceof webpack.optimize.UglifyJsPlugin) {
var index = config.plugins.indexOf(plugin);
config.plugins.splice(index, 1);
}
});
// If you only want this to happen during a prod build, add the
// following if statement:
// if (build.getConfig().production) { ... }
// Add our custom config plugin
config.plugins.push(new webpack.optimize.UglifyJsPlugin({
beautify: false,
mangle: { screw_ie8 : true, keep_fnames: true },
compress: {
screw_ie8: true /*,
warnings: false */ // if you don't want to see warnings from uglify
},
comments: false
}));
return config;
}
}); Please note that we use the following settings in the Uglify plugin: {
compress: {
dead_code: true,
warnings: false
},
mangle: true
} If you think it would be helpful, we can also provide an easy way to set the configuration for the Uglify plugin using a JSON config file, however, that would not be in the upcoming GA release. |
I think in an ideal world we would be able to import a standard webpack type configuration file (perhaps webpack.dev.json and webpack.production.json). Webpack is not completing at the moment, and I have:
Related issue: angular/components#1335 (comment) |
I would also add, that personally I would prefer if we switch off as much of this bundling stuff as possible, in the sense that for dev, we already have 1 level of abstraction with code being transposed from .ts to .js, but when the code is also bundled up into inline css and a single js file makes it again more difficult to debug. That's the kind of thing we can switch on if we want to be clever - and probably at SP1 ;-) |
Ah, OK, does eventually fail with:
|
OK, looks like this works:
And it's now giving a template error, but that would seem to be a separate issue:
Where the template is (which looks fine to me?):
Thanks for the help :-) |
Sounds like you got this working. We'll work on making the build tools more easily configurable in future releases. |
Did you get a chance to work more on this? Are there now other options to disable uglify/minimize so one can debug the solution properly? |
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues |
Category
How to I switch off mangle? I know with the SPFx project we don't have a webpack config, and it's in the gulpfile.json, but how would I go about putting in:
Related issue is here:
#406
The text was updated successfully, but these errors were encountered: