From db9dc3390bb400be430e45aa1f20de05902369e1 Mon Sep 17 00:00:00 2001 From: Matt Dunn-Rankin Date: Mon, 18 May 2020 00:11:18 -0700 Subject: [PATCH] code-split OutfitControls --- package.json | 1 + src/app/WardrobePage.js | 4 +++- yarn.lock | 12 ++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b6d7f90..64b180c 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "@chakra-ui/core": "^0.7.0", "@emotion/core": "^10.0.28", "@emotion/styled": "^10.0.27", + "@loadable/component": "^5.12.0", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", diff --git a/src/app/WardrobePage.js b/src/app/WardrobePage.js index 9394a95..3314e01 100644 --- a/src/app/WardrobePage.js +++ b/src/app/WardrobePage.js @@ -1,12 +1,14 @@ import React from "react"; import { Box, Grid, useToast } from "@chakra-ui/core"; +import loadable from "@loadable/component"; import ItemsAndSearchPanels from "./ItemsAndSearchPanels"; -import OutfitControls from "./OutfitControls"; import OutfitPreview from "./OutfitPreview"; import useOutfitState from "./useOutfitState.js"; import { usePageTitle } from "./util"; +const OutfitControls = loadable(() => import("./OutfitControls")); + /** * WardrobePage is the most fun page on the site - it's where you create * outfits! diff --git a/yarn.lock b/yarn.lock index 1db2cc4..996ceec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -954,7 +954,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.1.2", "@babel/runtime@^7.4.0": +"@babel/runtime@^7.1.2", "@babel/runtime@^7.4.0", "@babel/runtime@^7.7.7": version "7.9.6" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.9.6.tgz#a9102eb5cadedf3f31d08a9ecf294af7827ea29f" integrity sha512-64AF1xY3OAkFHqOb9s4jpgk1Mm5vDZ4L3acHvAml+53nO1XbXLuDodsVpO4OIUsmemlUHMxNdYMNJmsvOwLrvQ== @@ -1333,6 +1333,14 @@ "@types/yargs" "^15.0.0" chalk "^3.0.0" +"@loadable/component@^5.12.0": + version "5.12.0" + resolved "https://registry.yarnpkg.com/@loadable/component/-/component-5.12.0.tgz#34d056d15f53dc08d04e9203cad6867cf4f7306c" + integrity sha512-eDG7FPZ8tCFA/mqu2IrYV6eS+UxGBo21PwtEV9QpkpYrx25xKRXzJUm36yfQPK3o7jXu43xpPkwiU4mLWcjJlw== + dependencies: + "@babel/runtime" "^7.7.7" + hoist-non-react-statics "^3.3.1" + "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" @@ -5959,7 +5967,7 @@ hmac-drbg@^1.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0: +hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==