{"id":13116,"library":"ember-cli-lodash-subset","title":"Ember CLI Lodash Subset","description":"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.","status":"abandoned","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/ember-cli/ember-cli-lodash-subset","tags":["javascript"],"install":[{"cmd":"npm install ember-cli-lodash-subset","lang":"bash","label":"npm"},{"cmd":"yarn add ember-cli-lodash-subset","lang":"bash","label":"yarn"},{"cmd":"pnpm add ember-cli-lodash-subset","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import { get } from 'lodash-es';","symbol":"get","correct":"import { get } from 'lodash';"},{"note":"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.","wrong":"const _ = require('lodash');","symbol":"_","correct":"import _ from 'lodash';"},{"note":"Specific functions should be imported directly from 'lodash' (the alias provided by the addon) rather than deeper paths like 'lodash/debounce'.","wrong":"import { debounce } from 'lodash/debounce';","symbol":"debounce","correct":"import { debounce } from 'lodash';"}],"quickstart":{"code":"import Ember from 'ember';\nimport Component from '@ember/component';\nimport { debounce } from 'lodash';\nimport { isEmpty } from 'lodash';\n\nexport default Component.extend({\n  searchQuery: '',\n\n  init() {\n    this._super(...arguments);\n    // Define a debounced version of the search action\n    this.debouncedSearch = debounce(this.performSearch, 500);\n  },\n\n  actions: {\n    updateSearchQuery(event) {\n      this.set('searchQuery', event.target.value);\n      this.debouncedSearch();\n    },\n\n    performSearch() {\n      const query = this.get('searchQuery');\n      if (isEmpty(query)) {\n        console.log('Search query is empty, doing nothing.');\n        return;\n      }\n      console.log(`Searching for: ${query}`);\n      // In a real app, you'd trigger a service call or route transition here.\n    }\n  },\n\n  willDestroyElement() {\n    this._super(...arguments);\n    // Ensure debounce is cancelled to prevent memory leaks\n    this.debouncedSearch.cancel();\n  }\n});","lang":"typescript","description":"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."},"warnings":[{"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';`.","message":"The `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.","severity":"deprecated","affected_versions":">=2.0.0"},{"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.","message":"This 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').","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"This 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.","severity":"breaking","affected_versions":">=2.0.1"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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.","cause":"The requested Lodash function (`someFunction`) is not included in the custom subset build provided by `ember-cli-lodash-subset`.","error":"TypeError: _.someFunction is not a function"},{"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`).","cause":"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.","error":"Could not find module `lodash` imported from `my-app/components/my-component`"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}