Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ember-cli-terser

ember-cli279.3kMIT4.0.2

JavaScript minification for Ember-CLI

ember-addon

readme

ember-cli-terser

npm Build Status

terser integration to ember-cli to minify your JavaScript.

Installation

ember install ember-cli-terser

Usage

After installing ember-cli-terser it will automatically hook into the build pipeline and minify your JS files in production builds.

If you want to customize how ember-cli-terser is running terser under the hood you have several configuration options available:

// ember-cli-build.js

var app = new EmberApp({
  'ember-cli-terser': {
    enabled: true,

    exclude: ['vendor.js'],

    terser: {
      compress: {
        sequences: 50,
      },
      output: {
        semicolons: true,
      },
    },

    // Tell broccoli-terser-sourcemap to not add sourcemap URLs
    hiddenSourceMap: true,
  },
});

Options

  • enabled?: boolean: Enables/Disables minification (defaults to true for production builds, false for development builds)

  • exclude?: string[]: A list of paths or globs to exclude from minification

  • terser?: TerserOptions: A hash of options that are passed directly to terser

If no terser option is passed, a default configuration will be used.

Options supported by broccoli-terser-sourcemap may be added as top-level fields.

Source Maps

Source maps are disabled by default for production builds in Ember CLI. If you want to enable source maps for production builds you can configure that in your ember-cli-build.js too:

// ember-cli-build.js

var app = new EmberApp({
  sourcemaps: {
    enabled: true,
    extensions: ['js'],
  },
});

License

ember-cli-terser is licensed under the MIT License.

changelog

v4.0.2 (2021-04-28)

:bug: Bug Fix

  • #266 Move ember-cli-terser to run after broccoli-asset-rev (reduces sourcemapping issues in some contexts) (@mike-engel)

:memo: Documentation

  • #247 Mention how to configure broccoli-terser-sourcemap options (@jaswilli)

Committers: 3

v4.0.1 (2020-10-23)

:bug: Bug Fix

  • #236 Fix upgraing from ember-cli-uglify options in ember-cli-build.js (@rwjblue)

Committers: 2

v4.0.0 (2020-09-08)

:boom: Breaking Change

:rocket: Enhancement

:memo: Documentation

:house: Internal

Committers: 5

v3.0.0 (2019-04-12)

:boom: Breaking Change

:house: Internal

Committers: 2

v2.1.0 (2018-03-27)

:rocket: Enhancement

Committers: 1

v2.0.2 (2018-02-20)

:rocket: Enhancement

:house: Internal

  • #36 add test (basically, a default app built’s tests run even post uglifi… (@stefanpenner)

Committers: 2

v2.0.0 (2017-10-03)

:rocket: Enhancement

  • #28 Update "broccoli-uglify-sourcemap" to v2.0.0. (@Turbo87)

Committers: 1

v2.0.0-beta.2 (2017-09-08)

:bug: Bug Fix

Committers: 1

v2.0.0-beta.1 (2017-07-10)

:boom: Breaking Change

:memo: Documentation

v1.2.0 (2015-06-07)

:house: Internal