Ckeditor5: Remove src/lib/lodash in favor of lodash-es package. Update lodash to version 4.17.10

Created on 6 Aug 2018  路  8Comments  路  Source: ckeditor/ckeditor5

Until we find out a better solution for lodash, we can update this library to the latest version to solve a few problems.

utils task

All 8 comments

lodash-cli, which we use: https://github.com/ckeditor/ckeditor5-utils/blob/98508b0c15044ef870e2301edc1a0f2f41a8aeb1/package.json#L22 is achieved at version 4.17.5 (see https://github.com/lodash-archive/lodash-cli), which still has the problem in the debounce function's implementation - https://github.com/lodash/lodash/blob/4.17.5-es/debounce.js.

I'll remove this dep and will update the library directly from the GH (https://github.com/lodash/lodash/tree/es).

4.17.10-es branch is available on npm https://www.npmjs.com/package/lodash-es. Just saying ;)

Many import paths to rename, but it shouldn't be a problem.

I've checked and all tests pass with the [email protected].

What's more, we have a small boost in the weights of builds, e.g the size of ckeditor5-build-classic is decreased by 5kb.

4.17.10-es branch is available on npm https://www.npmjs.com/package/lodash-es

Thanks, I've forgotten about that package :)

Agree it might be worth to use 4.17.10-es. It should make the integration much simpler.

I'll start changing these lodash imports to the import { x } from 'lodash-es'. I completely forgot that with webapack@4 and this package marked as pure module it's the preferred way of importing lodash.

Ref https://twitter.com/jdalton/status/893109185264500737?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E893109185264500737&ref_url=https%3A%2F%2Fmedium.com%2Fmedia%2Ffa597f1dc9b4c8d5fd8ff603bd007369%3FpostId%3D2734fa13b5cd.

So we should gain even more after this change.

The builds weight the same as before (5kb less than now), but the import syntax is much nicer. And for some integration built from the source, it should save a few bytes. Lerna perfectly flattens all lodash-es to only one node_modules/lodash-es at the top level.

As removing the lodash from the ckeditor5-utils would result in BC, we can change all imports to new ones, but preserve old lodash files under src/lib/lodash until a new major release. WDYT?

I do not think we should support 2 versions of lodash. I think that we should do the major release of CKEditor 5 utils because of this change.

Was this page helpful?
0 / 5 - 0 ratings