• Type: boolean
  • Default: true
  • Bundler: only support webpack

Specifies whether to modularize the import of lodash and remove unused lodash modules to reduce the code size of lodash.

This optimization is implemented using babel-plugin-lodash and swc-plugin-lodash under the hood.


This option is enabled by default, and Builder will automatically redirects the code references of lodash to sub-paths.

For example:

import _ from 'lodash';
import { add } from 'lodash/fp';

const addOne = add(1);[1, 2, 3], addOne);

The transformed code will be:

import _add from 'lodash/fp/add';
import _map from 'lodash/map';

const addOne = _add(1);
_map([1, 2, 3], addOne);

Disabling the Transformation

In some cases, the import transformation of lodash may generate unexpected code. In such cases, you can manually disable this optimization:

export default {
  performance: {
    transformLodash: false,