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
feat(defaults): default entry, output, mode #6140
Conversation
Strongly supportive of this default :) |
Some notes on this @sokra |
//TODO:
|
What about respecting package.json "module" for entry, "main" for output? |
@azz that is really only a convention meant for library packaging, and not specific for Web Application. Overall, any of these properties are easily to override. |
Also, don't merge this until we remove the validations from the webpack-cli. I will PR this right now. |
@sokra I was not seeing these test failures locally. Any advice welcomed. The rest are cleaned up though. |
hi @TheLarkInn |
@EugeneHlushko I'll give it a shot. I did have previously set |
Ah crap I pushed code from new dev build. When I find a chance I'll remove "root" commit and repush, otherwise @sokra feel free to also. |
It was intended to not be the default. The idea was to emit a warning be default that reminds you to create two configuration (dev vs prod) and forces you to actively set the If |
Regarding the I also tried this a while ago, but you get problems with these defaults when using the CLI. webpack allows this CLI syntax: With entry and output having default values this will get unclear:
|
I agree with @sokra here,
|
@sokra we should find a way to work around the cli issues, in regards to mode, I think it makes sense to give users a production bundling experience out of the box. At the least we can guarentee that for the 20-30 percent who don't understand, get performance or anything else, that we are ensuring at least code is minifies etc. |
f78d650
to
5e8700f
Compare
Okay lets split hairs here:
This is actually a really great point. I think we can step it up another notch instead of just forcing them to specify, we could still have it enabled to production + but then also warn them and say:
|
I actually thought about making |
webpack/webpack-cli#227 Dependent issue up for @ev1stensberg to review. |
@TheLarkInn @michael-ciniawsky left a review |
These errors make sense but I don't have time at the moment to fix them. Hopefully this week (maybe), next for sure. |
I'll remove the BinTestCases in a separate PR since they have been move to webpack-cli. |
Alright sounds good. |
Perhaps make the warning explicit about when the default is problematic? If mode: development is the default:
If mode: production is the default:
Separately, what about defaulting to "none" for v4 with a warning and then defaulting to development or production in v5? That would give people time to adjust. And the breaking change wouldn't come until v5. Also, with analytics you could incorporate how people use this feature to pick a default in v5. Perhaps in v4:
|
Since these are just defaults we are not in risk of overriding or breaking existing behaviors. Or if we do, it would be justified in a breaking change from v3-4. With that being said, we will still provide a warning stating that the mode was not specified. |
Hmm @sokra is there a more recommended way to push the warning if defaulted to production (and not set)? |
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
Thanks |
No prob :-D 🎉 |
What kind of change does this PR introduce?
This defaults the following properties to their following values:
entry
: "./src";output
<== turns out this was defaulted but just removed the webpack-cli validations (separate branch)mode
: "production" <== no reason why this shouldn't be the caseDid you add tests for your changes?
Not sure if needed w/ changing defaults besides schema
If relevant, link to documentation update:
Will add if accepted.
Summary
#0CJS
Does this PR introduce a breaking change?
Other information
This PR depends on webpack/webpack-cli#217 merging so that the validation from the CLI doesn't fail runs of webpack. So likely I'll need to update this and add the peerDep