ember-cli-esbuild-minifier

raw JSON →
6.1.0 verified Fri May 01 auth: no javascript

Ember-CLI addon that integrates esbuild for JavaScript minification in production builds. Current stable version is 6.1.0 (July 2024), with active development releasing new versions weekly or monthly. Replaces ember-cli-terser or ember-cli-uglify with faster minification using esbuild. Supports configurable options including exclusion patterns, source maps (linked, external, inline, both), and esbuild target specification. Does not support ES5 target. Communicates via ESBuild's workerpool.

error Cannot find module 'ember-cli-esbuild-minifier'
cause Package is named '@nullvoxpopuli/ember-cli-esbuild' on npm, not 'ember-cli-esbuild-minifier'.
fix
Install as '@nullvoxpopuli/ember-cli-esbuild' and configure in ember-cli-build.js under 'ember-cli-esbuild' key.
error The Brocfile returned undefined, which is not a valid Broccoli tree.
cause Misconfiguration or missing module.exports = app.toTree() in ember-cli-build.js.
fix
Ensure ember-cli-build.js ends with module.exports = app.toTree();
error ESBuild error: Top-level await is not available in the configured target environment
cause Target set too low (e.g., 'es2015') but code uses top-level await.
fix
Set target to at least 'es2022' or a modern browser that supports top-level await.
breaking ES5 targeting is not supported by esbuild.
fix Use 'target' option with a minimum of ES2015. For ES5 support, continue using ember-cli-terser.
gotcha Configuration key is 'ember-cli-esbuild' not 'ember-cli-esbuild-minifier'.
fix Use the correct config key in ember-cli-build.js: new EmberApp({ 'ember-cli-esbuild': { ... } })
gotcha Remove 'ember-cli-terser' or 'ember-cli-uglify' before installing to avoid conflicts.
fix Run npm uninstall ember-cli-terser ember-cli-uglify before installing this addon.
breaking Source maps disabled by default; must enable in ember-cli-build.js.
fix Add sourcemaps config: new EmberApp({ sourcemaps: { enabled: true, extensions: ['js'] } })
deprecated Source map option 'none' is deprecated; use false instead.
fix Set sourceMap: false instead of sourceMap: 'none'.
npm install ember-cli-esbuild-minifier
yarn add ember-cli-esbuild-minifier
pnpm add ember-cli-esbuild-minifier

Configures esbuild minification for production builds, excluding vendor.js, targeting ES2020, and generating external source maps.

// In your Ember app's ember-cli-build.js
let app = new EmberApp(defaults, {
  'ember-cli-esbuild': {
    enabled: true,
    exclude: ['vendor.js'],
    target: 'es2020',
    sourceMap: 'external'
  }
});

module.exports = app.toTree();