Skip to content
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

Documentation should be explicit about the default configs for development and production modes #7123

Closed
Maximaximum opened this issue Apr 25, 2018 · 14 comments

Comments

@Maximaximum
Copy link

Do you want to request a feature or report a bug?
documentation

What is the current behavior?
I've spent quite some time trying to figure out what is the exact configuration that is used when mode is set to production, but haven't found a clear answer yet.

I need to tweak a single config option (collapse_vars) for the UglifyJsPlugin and, as far as I see, there is no way to do it, except for setting mode to none and explicitly re-defining the whole production config, having the only difference from the default production config that UglifyJsPlugin.uglifyOptions.collapse_vars = false. But how do I know the default production config? I can't find it in the documentation, so I'm trying to find this out by trial and errors, which is totally counter-productive.

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?
It would be great if on this page https://webpack.js.org/concepts/mode/, instead of some weird diffs there were full and exact configs that are equivalent to setting mode to development or production.

If this is a feature request, what is motivation or use case for changing the behavior?
The user should be able to easily copy-and-paste the default config and tweak it to their needs.

Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.

@Maximaximum
Copy link
Author

Just in case someone is interested, why do I need to set collapse_vars to false, is because of this bug: mishoo/UglifyJS#3096 which has been fixed but not yet released.

@kzc
Copy link

kzc commented Apr 25, 2018

The webpack config is not exactly obvious...

#6567 (comment)

and that example did not detect production mode correctly. You need to do this:

#6460 (comment)

@montogeek
Copy link
Member

It is in the docs https://webpack.js.org/concepts/mode/#usage

@montogeek
Copy link
Member

Also, report documentation issue to https://github.com/webpack/webpack.js.org

@Maximaximum
Copy link
Author

It is in the docs https://webpack.js.org/concepts/mode/#usage

No, it is not - that's why I've created this issue. See:

It would be great if on this page https://webpack.js.org/concepts/mode/, instead of some weird diffs there were full and exact configs that are equivalent to setting mode to development or production.

On https://webpack.js.org/concepts/mode/#usage page I don't see, for example, the config object being passed to UglifyJsPlugin constructor

@Maximaximum
Copy link
Author

@kzc well, the documentation lacks clear information about the optimization.minimizer option as well - that's why I was unable to find it 😞

@Maximaximum
Copy link
Author

@montogeek copied this issue to webpack/webpack.js.org#2080

@Maximaximum
Copy link
Author

Also, created webpack/webpack.js.org#2081 regarding the optimization.minimizer option

@montogeek
Copy link
Member

We can't duplicate documentation everywhere, UglifyJsPlugin options are on its respective page: https://webpack.js.org/plugins/uglifyjs-webpack-plugin/

@montogeek
Copy link
Member

montogeek commented Apr 26, 2018

Lets continue this documentation issue on webpack/webpack.js.org#2080

@montogeek montogeek marked this as a duplicate of webpack/webpack.js.org#2080 Apr 26, 2018
@Maximaximum
Copy link
Author

@montogeek well, I can't find any mentions of optimization.minimizer option on https://webpack.js.org/plugins/uglifyjs-webpack-plugin/ page anyway

@montogeek
Copy link
Member

@Maximaximum It shouldn't be there, it is a different option, you can use any plugin as minimizer option, I don't know if there is more 🤔

@montogeek
Copy link
Member

@Maximaximum I just merged webpack/webpack.js.org#2053, it is already live https://webpack.js.org/configuration/optimization/

@Maximaximum
Copy link
Author

@montogeek Yeah, thanks a lot! 😃 Now it's clear about optimization.minimizer.

It would be great to resolve webpack/webpack.js.org#2080 as well. 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants