Build & Bundle

ember build --environment=production

Build & Bundle

Production builds output to dist — minified, fingerprinted assets ready for any static host or CDN.

4 min read Level 2/5 #ember#build#production
What you'll learn
  • Run ember build --environment=production
  • Inspect the dist folder structure
  • Configure asset rewrites and rootURL for a CDN

ember build is the production pipeline — minification, fingerprinting, and asset rewrites in one command. The output is a plain static dist/.

Build Command

ember build --environment=production

This drops a minified app into dist/. For source maps add --source-map. For a quick prod build during debugging, ember build -prod works as a short alias.

What Is in dist?

dist/
├── index.html
├── assets/
   ├── my-app-<hash>.js
   ├── my-app-<hash>.css
   ├── vendor-<hash>.js
   └── vendor-<hash>.css
├── crossdomain.xml
└── robots.txt

Filenames are content-hashed — safe to cache forever.

Configure rootURL and Host

// config/environment.js
module.exports = function (environment) {
  const ENV = {
    modulePrefix: 'my-app',
    environment,
    rootURL: '/',
    locationType: 'history',
  };

  if (environment === 'production') {
    ENV.rootURL = 'https://cdn.example.com/';
    ENV.fingerprint = { prepend: ENV.rootURL };
  }

  return ENV;
};

prepend makes every asset URL absolute — required when serving JS/CSS from a CDN.

Bundle Analysis

ember build -prod --stats

Drop the stats file into a bundle visualizer (e.g. ember-cli-bundle-analyzer) to see what is bloating your build.

Deployment →