I’m submitting a feature request
Webpack version:
2.x
Please tell us about your environment:
OSX 10.x / Linux / Windows 10
Current behavior:
You must specify at minimum an entry property and an output property.
Expected/desired behavior:
Do we really need to? Or could these be generic properties. I imagine the following by default:
(THIS IS JUST AN EXAMPLE, not what it really needs to be).
entry: {
main: './src/index.js'
},
output: {
filename: '[name].bundle.js',
path: 'dist'
}
- What is the motivation / use case for changing the behavior?
tl;dr: @gaearon suggested this to me and I agree that we could make a sensible default for these two values. In the end do things like input and output always get changed, most likely, yes. But there’s also no reason to not have a default. - Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
- Language: [all | TypeScript X.X | ES6/7 | ES5 | Dart | …]
Yes please. Perhaps check
src/index
thenindex
I would warn against trying to support 5 different popular conventions. People are confused by Webpack precisely because its inputs are too relaxed and break subtly in unexpected ways. Pick one convention and run with it. It’s just a default after all.
As for looking for “main” field this could be confusing because “main” should usually point to compiled output, not the source.
I’d go against a default value for
entry
:webpack
feels more magical thanwebpack ./src/index.js
(with nowebpack.config.js
). Maybe this is me but this looks too implicit and thus confusing../src/index.js
as an entry.entry
depending ontarget
feels wrong. That does suggest that there’s no default.I’m all for having a default value for
output
but I’d rather make it put all build artefacts into a directory, for examplebuild/
. That way it is easy to get rid of them — justrm -r build/
— I think this is important.