Skip to content

Commit 10dffc5

Browse files
committed
Use lodash-es to reduce bundle size
1 parent 3ba073c commit 10dffc5

File tree

10 files changed

+42
-27
lines changed

10 files changed

+42
-27
lines changed

packages/ilmomasiina-components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
},
2727
"dependencies": {
2828
"@tietokilta/ilmomasiina-models": "workspace:2.0.0-alpha13",
29-
"@types/lodash": "^4.14.182",
29+
"@types/lodash-es": "^4.17.9",
3030
"@types/react": "^17 || ^18",
3131
"bootstrap": "^4.6.1",
3232
"final-form": "^4.20.10",
3333
"formik": "^2.4.5",
3434
"i18next": "^22.4.11",
35-
"lodash": "^4.17.21",
35+
"lodash-es": "^4.17.21",
3636
"moment": "^2.29.3",
3737
"moment-timezone": "^0.5.34",
3838
"react": "^17 || ^18",

packages/ilmomasiina-components/src/routes/EditSignup/components/QuestionFields.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React, { ReactNode } from 'react';
22

33
import { useField } from 'formik';
4-
import find from 'lodash/find';
5-
import reject from 'lodash/reject';
6-
import without from 'lodash/without';
4+
import find from 'lodash-es/find';
5+
import reject from 'lodash-es/reject';
6+
import without from 'lodash-es/without';
77
import { Form } from 'react-bootstrap';
88
import { useTranslation } from 'react-i18next';
99

packages/ilmomasiina-components/src/routes/SingleEvent/components/SignupList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import filter from 'lodash/filter';
3+
import filter from 'lodash-es/filter';
44
import { Table } from 'react-bootstrap';
55
import { useTranslation } from 'react-i18next';
66

packages/ilmomasiina-components/src/routes/SingleEvent/components/SignupListRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22

3-
import filter from 'lodash/filter';
4-
import find from 'lodash/find';
3+
import filter from 'lodash-es/filter';
4+
import find from 'lodash-es/find';
55
import moment from 'moment-timezone';
66
import { useTranslation } from 'react-i18next';
77

packages/ilmomasiina-components/src/utils/eventListUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import every from 'lodash/every';
2-
import sumBy from 'lodash/sumBy';
1+
import every from 'lodash-es/every';
2+
import sumBy from 'lodash-es/sumBy';
33
import moment, { Moment } from 'moment-timezone';
44

55
import type {

packages/ilmomasiina-components/src/utils/signupUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import find from 'lodash/find';
2-
import orderBy from 'lodash/orderBy';
3-
import sumBy from 'lodash/sumBy';
1+
import find from 'lodash-es/find';
2+
import orderBy from 'lodash-es/orderBy';
3+
import sumBy from 'lodash-es/sumBy';
44
import moment from 'moment-timezone';
55

66
import type {

packages/ilmomasiina-frontend/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@tietokilta/ilmomasiina-components": "workspace:2.0.0-alpha13",
2020
"@tietokilta/ilmomasiina-models": "workspace:2.0.0-alpha13",
2121
"@types/history": "^4.7.11",
22-
"@types/lodash": "^4.14.182",
22+
"@types/lodash-es": "^4.17.9",
2323
"@types/node": "^16.11.41",
2424
"@types/node-sass": "^4.11.2",
2525
"@types/react": "^17.0.47",
@@ -39,7 +39,7 @@
3939
"history": "^4.10.1",
4040
"i18next": "^22.4.11",
4141
"i18next-browser-languagedetector": "^7.0.1",
42-
"lodash": "^4.17.21",
42+
"lodash-es": "^4.17.21",
4343
"moment": "^2.29.3",
4444
"moment-timezone": "^0.5.34",
4545
"react": "^17.0.2",
@@ -65,8 +65,10 @@
6565
"typescript": "~4.9"
6666
},
6767
"devDependencies": {
68+
"@types/lodash": "^4.14.199",
6869
"@types/ws": "^8.5.3",
6970
"rimraf": "^3.0.2",
71+
"lodash": "^4.17.21",
7072
"ws": "^8.8.0"
7173
}
7274
}

packages/ilmomasiina-frontend/scripts/build.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ build(config)
1313
const totals = new Map<string, number>();
1414
for (const [path, { bytesInOutput }] of Object.entries(inputs)) {
1515
// extract package name from path
16-
const names = path.replace(/\\/g, '/').match(/\/node_modules\/(?:@[^/]+\/)?[^/]+/g) || ['.'];
17-
const lastName = names[names.length - 1].replace('/node_modules/', '');
16+
// const names = path.replace(/\\/g, '/').match(/\/node_modules\/(?:@[^/]+\/)?[^/]+/g) || ['.'];
17+
// const lastName = names[names.length - 1].replace('/node_modules/', '');
1818
// count size
19-
totals.set(lastName, (totals.get(lastName) ?? 0) + bytesInOutput);
19+
totals.set(path, (totals.get(path) ?? 0) + bytesInOutput);
2020
}
2121

2222
// sort by name

packages/ilmomasiina-frontend/src/routes/AdminEvents/AdminEventListItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { MouseEvent } from 'react';
22

3-
import sumBy from 'lodash/sumBy';
3+
import sumBy from 'lodash-es/sumBy';
44
import moment from 'moment-timezone';
55
import { useTranslation } from 'react-i18next';
66
import { Link } from 'react-router-dom';

pnpm-lock.yaml

Lines changed: 21 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)