Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce installation size #609

Merged
merged 6 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ _Note: Gaps between patch versions are faulty, broken or test releases._

* **Internal**
* Replace some lodash usages with JavaScript native API ([#505](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/505)) by [@sukkaw](https://github.com/sukkaw).
* Make module much slimmer ([#609](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/609)) by [@sukkaw](https://github.com/sukkaw).

## 4.9.0

Expand Down
13 changes: 7 additions & 6 deletions client/components/ModuleItem.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import _ from 'lodash';
import escapeRegExp from 'escape-string-regexp';
import escape from 'lodash.escape';
import filesize from 'filesize';
import cls from 'classnames';

Expand Down Expand Up @@ -47,7 +48,7 @@ export default class ModuleItem extends PureComponent {
if (term) {
const regexp = (term instanceof RegExp) ?
new RegExp(term.source, 'igu') :
new RegExp(`(?:${_.escapeRegExp(term)})+`, 'iu');
new RegExp(`(?:${escapeRegExp(term)})+`, 'iu');
let match;
let lastMatch;

Expand All @@ -58,15 +59,15 @@ export default class ModuleItem extends PureComponent {

if (lastMatch) {
html = (
_.escape(title.slice(0, lastMatch.index)) +
`<strong>${_.escape(lastMatch[0])}</strong>` +
_.escape(title.slice(lastMatch.index + lastMatch[0].length))
escape(title.slice(0, lastMatch.index)) +
`<strong>${escape(lastMatch[0])}</strong>` +
escape(title.slice(lastMatch.index + lastMatch[0].length))
);
}
}

if (!html) {
html = _.escape(title);
html = escape(title);
}

return html;
Expand Down
4 changes: 2 additions & 2 deletions client/components/Search.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash';
import debounce from 'lodash.debounce';

import s from './Search.css';
import Button from './Button';
Expand Down Expand Up @@ -39,7 +39,7 @@ export default class Search extends PureComponent {
);
}

handleValueChange = _.debounce((event) => {
handleValueChange = debounce((event) => {
this.informChange(event.target.value);
}, 400)

Expand Down
Loading