Registry / devops / ember-cli-lodash-subset

ember-cli-lodash-subset

JSON →
library2.0.1jsnpmunverified

ember-cli-lodash-subset is an Ember CLI addon designed to optimize application startup times by creating a custom, trimmed-down build of Lodash. It leverages Rollup and `lodash-es` to selectively include only the Lodash functions explicitly defined in its `lodash.subset.js` configuration. This approach aims to reduce the overall JavaScript bundle size, offering a 20-30% improvement in Ember CLI startup performance by eliminating unused Lodash utilities. The current version is 2.0.1, published several years ago. There is no active development or regular release cadence for this specific package. While it offered significant benefits upon its release, modern Ember CLI applications typically achieve similar tree-shaking benefits for Lodash by directly using `lodash-es` with `ember-auto-import`, making this addon largely superseded and less relevant in current Ember development workflows.

npm install ember-cli-lodash-subset
INSTALL
IMPORT
SIG · EMBER-CLI-LODASH-S
E
ember-cli-lodash-subset
devopsjavascriptv2.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

get
import { get } from 'lodash';
import { get } from 'lodash-es';
The addon makes Lodash functions available under the 'lodash' path, not 'lodash-es' directly, even though it uses 'lodash-es' for its build. Named imports are preferred for tree-shaking.
_
import _ from 'lodash';
const _ = require('lodash');
While possible, importing the entire Lodash object (`_`) via a default import largely negates the bundle size optimization benefits of this addon, as it prevents effective tree-shaking.
debounce
import { debounce } from 'lodash';
import { debounce } from 'lodash/debounce';
Specific functions should be imported directly from 'lodash' (the alias provided by the addon) rather than deeper paths like 'lodash/debounce'.

Demonstrates installing the addon, then importing and using `debounce` and `isEmpty` from the custom Lodash subset within an Ember component for a debounced search input.

import Ember from 'ember'; import Component from '@ember/component'; import { debounce } from 'lodash'; import { isEmpty } from 'lodash'; export default Component.extend({ searchQuery: '', init() { this._super(...arguments); // Define a debounced version of the search action this.debouncedSearch = debounce(this.performSearch, 500); }, actions: { updateSearchQuery(event) { this.set('searchQuery', event.target.value); this.debouncedSearch(); }, performSearch() { const query = this.get('searchQuery'); if (isEmpty(query)) { console.log('Search query is empty, doing nothing.'); return; } console.log(`Searching for: ${query}`); // In a real app, you'd trigger a service call or route transition here. } }, willDestroyElement() { this._super(...arguments); // Ensure debounce is cancelled to prevent memory leaks this.debouncedSearch.cancel(); } });
Debug
Known issues
deprecatedThe `ember-cli-lodash-subset` addon is largely superseded by modern Ember CLI features, specifically `ember-auto-import` (available since Ember v3.x) used with `lodash-es`. These allow direct NPM package imports and efficient tree-shaking of Lodash, often achieving similar or better optimization without this addon.
fix
Consider migrating to `lodash-es` and relying on `ember-auto-import` for tree-shaking. Remove `ember-cli-lodash-subset` and update your `package.json` to include `lodash-es` as a dependency, then import directly: `import { functionName } from 'lodash-es';`.
affects: >=2.0.0
gotchaThis addon provides only a *subset* of Lodash. If a Lodash function is not explicitly listed in the `lodash.subset.js` configuration within the addon's source, attempting to import or use it will result in a runtime error (e.g., 'X is not a function' or 'Cannot read properties of undefined').
fix
Verify that the required Lodash function is included in your `lodash.subset.js` (if you are maintaining a fork of the addon) or the addon's default subset. If not, you may need to extend the subset (requires forking the addon) or switch to a full Lodash inclusion or `lodash-es` with tree-shaking for un-subsettized functions.
affects: >=1.0.0
breakingThis package is no longer actively maintained. Its GitHub repository shows no recent activity, and its last known publication was several years ago. It may not be compatible with newer versions of Node.js, Ember CLI, or other ecosystem dependencies, leading to build failures or unexpected runtime behavior.
fix
It is strongly recommended to migrate away from this abandoned package. Use `lodash-es` directly with `ember-auto-import` for modern Ember applications or consider alternative utility libraries.
affects: >=2.0.1
Errors
Common errors & fixes
TypeError: _.someFunction is not a function
The requested Lodash function (`someFunction`) is not included in the custom subset build provided by `ember-cli-lodash-subset`.
fix
Check the `lodash.subset.js` file (within the addon's repository) to confirm if the function is part of the custom build. If not, you either need to modify the subset (by forking the addon) or use a different method to include that Lodash function.
Could not find module `lodash` imported from `my-app/components/my-component`
The `ember-cli-lodash-subset` addon or its configuration is not correctly integrated into the Ember CLI build process, or it has been removed without updating imports.
fix
Ensure `ember-cli-lodash-subset` is correctly installed (`npm install ember-cli-lodash-subset --save-dev` or `yarn add ember-cli-lodash-subset --dev`) and that your Ember application's `ember-cli-build.js` is properly configured. If migrating away from the addon, change all `import from 'lodash'` statements to `import from 'lodash-es'` (after installing `lodash-es`).
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
ember-cli-lodash-subset — npm install ember-cli-lodash-subset · libregistry