Have you considered turning this into a gem?
It’s definitely worth considering. Let’s discuss this!
There’s a couple ways we could go:
- Generator: We could have a simple generator to create the directories, the config files, etc. This just saves some time for a new project.
- Webpack in Sprockets: We could have Webpack work like browserify-rails. This would change the way that sprockets handles assets.
What is the criteria for success?
- Ease of use for beginners so that they could get the basic essentials of webpack without fully needing to understand all the configuration nuances.
- Ease of use to prototype JS code using the Webpack Dev Server.
- No need to remember to run ‘webpack -w’ to automatically rebuild the bundle.js file.
- Simpler deployment to places like Heroku.
One thing that I find important is that the current mechanism makes it dead simple in terms of understanding what’s going on with WebPack. The problem with highly automated “wizards” is that when one wants to make an extension to the default configuration, then there’s a big learning curve. However, I do think the ability to get the benefits of this setup by following a few simple conventions would have great appeal.