https://github.com/ember-cli/ember-cli-terser
JavaScript minification for Ember-CLI
https://github.com/ember-cli/ember-cli-terser
Last synced: 6 months ago
JSON representation
JavaScript minification for Ember-CLI
- Host: GitHub
- URL: https://github.com/ember-cli/ember-cli-terser
- Owner: ember-cli
- License: mit
- Created: 2015-01-26T13:44:48.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-09-27T22:59:01.000Z (over 2 years ago)
- Last Synced: 2025-07-26T03:04:17.489Z (6 months ago)
- Language: JavaScript
- Size: 1.2 MB
- Stars: 23
- Watchers: 7
- Forks: 27
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
ember-cli-terser
==============================================================================
[](https://www.npmjs.com/package/ember-cli-terser)
[](https://github.com/ember-cli/ember-cli-terser/actions?query=workflow%3ACI)
[terser](https://github.com/terser/terser) integration to
[ember-cli](http://cli.emberjs.com/) to minify your JavaScript.
Installation
------------------------------------------------------------------------------
```
ember install ember-cli-terser
```
Embroider
------------------------------------------------------------------------------
Note that, `ember-cli-terser` has no effect under
[Embroider](https://github.com/embroider-build/embroider), as Embroider
provides its own minification process based on terser. This means that, apps
using Embroider, can safely uninstall `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:
```js
// 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](https://github.com/terser/terser#minify-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](https://github.com/ember-cli/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:
```js
// ember-cli-build.js
var app = new EmberApp({
sourcemaps: {
enabled: true,
extensions: ['js'],
},
});
```
License
------------------------------------------------------------------------------
ember-cli-terser is licensed under the [MIT License](LICENSE.md).