ember-cli-terser is an Ember CLI addon designed to integrate the Terser JavaScript minifier into the Ember CLI build pipeline. Its primary function is to automatically minify JavaScript files during production builds, thereby optimizing application size and improving loading performance. The current stable version is 4.0.2. Its release cadence is generally aligned with major versions of the underlying `terser` library and updates to the Ember CLI ecosystem, often involving necessary Node.js support changes. A key differentiator is its seamless integration into the Ember CLI environment, allowing developers to configure `terser` options directly within `ember-cli-build.js` without manual adjustments to the build process. It effectively supersedes older minifiers like UglifyJS, providing modern JavaScript minification capabilities for Ember applications.
npm install ember-cli-terserVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to install `ember-cli-terser` and configure its minification options, including Terser-specific settings and source map handling, within an Ember CLI project's `ember-cli-build.js` file.
Review your `ember-cli-build.js` configuration. Ensure all `terser` options (e.g., `compress`, `output`, `mangle`) are fully specified if you relied on previous implicit defaults. Consult the `terser@5` documentation for available options.
Verify that your `terser` configuration in `ember-cli-build.js` is compatible with `terser@5`. Consult the `terser` changelog for any breaking changes in option syntax or default behaviors between v4 and v5.
Upgrade your Node.js environment to a supported version: 10.*, 12.*, or >= 14.
To enable source maps for production, configure `sourcemaps: { enabled: true, extensions: ['js'] }` in your `ember-cli-build.js`. Additionally, you might use `hiddenSourceMap: true` within `ember-cli-terser` options to prevent source map URLs from being added to output files.Carefully review the `terser` configuration object within your `ember-cli-build.js` against the `terser@5` documentation and the `ember-cli-terser` README. Ensure all options are correctly nested and adhere to the current API.
If minification is desired in development, explicitly set `enabled: true` in the `ember-cli-terser` options within `ember-cli-build.js`. For production-like builds, use `ember build --environment=production`.
Upgrade your Node.js environment to a compatible version (10.*, 12.*, or >= 14) as specified in the package's `engines` field.
Gradually relax `terser` options in `ember-cli-build.js`, starting with `compress.sequences`, `compress.dead_code`, `mangle.safari10`, or by adding problematic files to the `exclude` array. Test thoroughly after each adjustment to pinpoint the problematic option.