Skip to content

Instantly share code, notes, and snippets.

@viniciussbs
Forked from vasind/ember-cli-build.js
Created April 6, 2020 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viniciussbs/b69a1c083540757cf23cae86231ffafb to your computer and use it in GitHub Desktop.
Save viniciussbs/b69a1c083540757cf23cae86231ffafb to your computer and use it in GitHub Desktop.
Ember CLI performance improvements and tips
// Credits to the following posts that helps me to reduce build times drastically
// https://discuss.emberjs.com/t/tips-for-improving-build-time-of-large-apps/15008/12
// https://www.gokatz.me/blog/how-we-cut-down-our-ember-build-time/
//ember-cli-build.js
let EmberApp = require('ember-cli/lib/broccoli/ember-app');
let env = EmberApp.env(),
IS_PROD = env === 'production',
IS_TEST = env === 'test' ;
module.exports = function(defaults) {
let app = new EmberApp(defaults, {
hinting: IS_TEST, // Disable linting for all builds but test
tests: IS_TEST, // Don't even generate test files unless a test build
"ember-cli-babel": {
includePolyfill: IS_PROD // Only include babel polyfill in prod
},
autoprefixer: {
sourcemap: false // Was never helpful
},
sourcemaps: {
enabled: IS_PROD // CMD ALT F in chrome is *almost* as fast as CMD P
},
fingerprint: {
enabled: IS_PROD //Asset rewrite will takes more time and fingerprinting can be omitted in development
},
sassOptions: {
// moving from compass compiler to node gave huge improvement
implementation: nodeSass, //implementation here is node-sass,
sourceMap : false //will debug with generated CSS than sourcemap :)
},
// Only import other polyfills in production
if (IS_PROD) {
app.import('vendor/ie-polyfill.js');
}
return app.toTree();
}
}
// config/environment.js
if (environment === 'development') {
ENV['ember-cli-mirage'] = {
enabled: false,
excludeFilesFromBuild: true // Don't include lodash and everything else mirage needs
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment