Should I use Webpack?


#1

Hi,

I’m coming from PHP so I’m not very familiar with JS technologies so I apologize in advance if this question is too obvious.

I searched for Webpack and Ember and couldn’t find anything official from Ember on how to integrate them.

What I have done so far:

  1. created a project (not an Ember project) where webpack hot reloading is enabled, bootstrap sass loader added, etc;
  2. initialized an Ember project with “ember init” and modified package.json to add the changes coming from ember-cli.

What’s next? How to set webpack to properly work with Ember at this point?


#2

@seal webpack is extremely popular for modern front-end development, but Ember has it’s own build tools so webpack isn’t necessary and in fact would probably be pretty hard to use. The good news is that webpack generally requires at least some custom config, and Ember’s build system works out of the box with essentially no config changes, so it should be easier to get up and running.

AFAIK Ember predates Webpack and from early on Ember’s philosophy was, much like Rails, to provide an easy to use cli and a “batteries included” approach to front-end development. Therefore the ember-cli included its own build tools and has to this day. I’m sure others could better elaborate on the history and philosophy but all that to say: currently Ember does it’s own thing and doesn’t support webpack. There’s currently some work underway to break Ember apart into its constituent pieces (router, templating engine, data, build system, etc) and maybe someday you’ll be able to choose your own build tools, who knows (well I don’t at least).

I’ll reiterate that this is good news unless you really wanted to learn webpack. Ember makes it really easy to get up and running, install dependencies, live reload the app on changes using the dev server, and crush some production ready builds together. For more details on that I’d recommend the ember guides, and of course feel free to ask more questions here or in Slack!


#3

@dknutsen thank you! I was worried I was missing some obvious step on how to ingrate Webpack but apparently that wasn’t the case. You mentioned Rails, and I work with a PHP framework called CakePHP which is based on Rails, so I understand what you meant by “batteries included” approach. Based on your info, I’ll recreate the project using the ember-cli alone.


#4

Good luck! And definitely post if you have any other questions :grin: