Suggesting webpack.config.json

Do you want to request a feature or report a bug?
Not request, but suggest a feature 😉

What is the current behavior?
This suggestion is based on the following tweet from @TheLarkInn : https://twitter.com/TheLarkInn/status/941431327890358272. I think the reason developers get a bit off put by the configuration is simple things like path.join, regexps and new webpack.optimize.somePlugin(). This is not typical config syntax.

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

What is the expected behavior?
I think Webpack would benefit from having a simplified webpack.config.json as default. A limited configuration which is pure json. Take @TheLarkInn example on twitter:

{
  "entry": "./src",
  "output": "./static/index.js",
  "loaders": {
    ".js": "babel-loader"
  }
}

This is of course just an example to prove a point, using the following limitations:

  • All paths are relative to config path
  • output has been simplified to a single path with filename
  • module.rules has been simplified to a loaders map of file endings with loader name
  • mode is by default “development” unless NODE_ENV equlas “production”

If this is a feature request, what is motivation or use case for changing the behavior?
Webpack is an amazing tool, I have been using it myself for several years, but it shoves too much functionality on developers from the get go. If developers could start off with a simple config file, to reap the benefits of Webpack instantly it would be less of a jump opting into the the webpack.config.js version for more granular control. This is more of a first impression thing than anything else!

The challenge here is to decide on an official simplified format, but yeah… had a moment of inspiration after the tweet, so thought I would start suggesting the approach first 🙂

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

Author: Fantashit

1 thought on “Suggesting webpack.config.json

Comments are closed.