rusackas opened a new pull request, #41511:
URL: https://github.com/apache/superset/pull/41511

   ### SUMMARY
   
   Migrates the frontend's bare lodash imports to **`lodash-es`** for native, 
method-level tree-shaking. `import { debounce } from 'lodash'` → `import { 
debounce } from 'lodash-es'` across **173 source files**.
   
   `lodash` (the CommonJS build) doesn't tree-shake — importing a single method 
pulls in the whole library unless a build-time transform rewrites it. The repo 
relied on `babel-plugin-lodash` for that rewrite, but that plugin is 
**unmaintained and incompatible with Babel 8** (it calls the removed 
`path.hoist` API). `lodash-es` is the modern replacement: webpack tree-shakes 
it natively, no Babel plugin required.
   
   This pairs with the Babel 8 upgrade (#41510), which removes 
`babel-plugin-lodash`. Doing the lodash-es migration here keeps the app's 
bundle lean without that plugin. The two PRs are independent and can merge in 
either order.
   
   **Why this is low-risk:**
   - The codemod only touches **named imports** (`import { x } from 'lodash'`), 
which map 1:1 to `lodash-es`. There were **zero** default (`import _ from 
'lodash'`) or namespace (`import * as _`) imports — the shapes `lodash-es` 
doesn't support.
   - `@types/lodash-es` provides the same type signatures as `@types/lodash`, 
so no type changes (`tsc --noEmit` clean).
   - `lodash-es` is already in jest's `transformIgnorePatterns`.
   - `lodash` is retained as a dependency for the handful of remaining 
per-method `lodash/x` imports and transitive consumers.
   - `lodash-es` declared in every workspace manifest that imports it (plus 
`@types/lodash-es` at the root) for published-package correctness.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-frontend
   npm ci
   npm run build   # production webpack build
   npm run test    # Jest unit suite
   ```
   
   Validated locally: production webpack build compiles (pre-existing 
echarts/bundle-size warnings only), Jest unit suite passes, and `tsc --noEmit` 
reports no type errors from the change.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Related: #41510 (Babel 8 upgrade, which removes `babel-plugin-lodash`)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to