Skip to content

Commit

Permalink
Switch to lodash-es and embed it in the bundle
Browse files Browse the repository at this point in the history
This switches to lodash-es to properly use a tree-shakable version of lodash.
It also makes sure that we're including the lodash methods we use in the bundle instead of having it as a library dependency.
  • Loading branch information
sandhose committed Aug 4, 2023
1 parent eab663c commit ebb6855
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-storybook": "^0.6.13",
"jsdom": "^22.1.0",
"lodash-es": "^4.17.21",
"prettier": "3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -98,8 +99,7 @@
},
"dependencies": {
"@radix-ui/react-form": "^0.0.3",
"classnames": "^2.3.2",
"lodash": "^4.17.21"
"classnames": "^2.3.2"
},
"peerDependencies": {
"@fontsource/inter": "^5",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { split } from "lodash";
import { split } from "lodash-es";

export const MX_USERNAME_PREFIX = "@";
export const MX_ROOM_PREFIX = "#";
Expand Down
1 change: 0 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default defineConfig({
"react-dom/server",
"react/jsx-runtime",
"react/jsx-dev-runtime",
"lodash",
"classnames",
"@radix-ui/react-form",
],
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7260,6 +7260,11 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"

lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==

lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
Expand Down

0 comments on commit ebb6855

Please sign in to comment.