I have been building a web app in Ember, and am ready to upload it on a server.
What “ember build --environment production” does?
Need to change any settings in environment.js?
I have been building a web app in Ember, and am ready to upload it on a server.
What “ember build --environment production” does?
Need to change any settings in environment.js?
The short answer is “maybe nothing but it really depends”. What settings you might want to change depend on a few things:
<app>/foo/bar/1
to actually request <app>/foo/bar/1.html
from the server. One of the ways around this is setting locationType in config/environment.js to “hash”, but then your URLs look like <app>/#/foo/bar/1
, so many people prefer to configure the server side instead. Really depends.The biggest one you may want to configure is your backend, but depending on what that looks like you may not have to configure much of anything at first. If you can post some more details about your backend, production target (for the ember app, e.g. S3, Apache, etc.), and any third party addons or APIs you are using I could try to make some suggestions.
As far as what a production build actually does…
EmberCLI recognizes three actual environments for build: test, development, production. All builds take all of your js/css/htmlbars etc in app/
and smash it all together into app.js, vendor.js, app.css, vendor.css, and then link those files to the index.html (there’s some other files involved but that’s not that important atm). It stores these “compiled” assets in /dist/
by default. Production builds vary from development builds a lot, but in broad strokes they are usually minified, compressed, and often fingerprinted. I think production builds also usually include a lot less code from addons and such as well but that really depends.
There are three supported environments: development, test, and production. The way to think about them is:
Any time you’re going to deploy an ember app to a server (whether that server is your “production” one or some staging one), --environment=production
is the appropriate choice.
Production builds are smaller and faster. Dev builds include extra code for detecting possible problems and giving developers more helpful warnings and errors.