From 78e9dbb336be52c554801dd630f61fd095ebf191 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 4 Feb 2023 17:16:22 -0500 Subject: [PATCH] Remove webpackChunkName annotation --- app/components/AuthenticatedLayout.tsx | 20 ++-------- app/components/Editor.tsx | 8 +--- app/components/IconPicker.tsx | 6 +-- app/components/TableFromParams.tsx | 8 +--- app/components/Time.tsx | 8 +--- app/index.tsx | 5 +-- app/routes/authenticated.tsx | 40 +++---------------- app/routes/index.tsx | 40 +++---------------- .../components/AsyncMultiplayerEditor.ts | 8 +--- app/utils/polyfills.ts | 5 +-- shared/editor/plugins/Math.ts | 5 +-- shared/editor/plugins/Mermaid.ts | 5 +-- 12 files changed, 22 insertions(+), 136 deletions(-) diff --git a/app/components/AuthenticatedLayout.tsx b/app/components/AuthenticatedLayout.tsx index ee421ca816..554b43eb31 100644 --- a/app/components/AuthenticatedLayout.tsx +++ b/app/components/AuthenticatedLayout.tsx @@ -25,26 +25,12 @@ import { import Fade from "./Fade"; const DocumentHistory = React.lazy( - () => - import( - /* webpackChunkName: "document-history" */ - "~/scenes/Document/components/History" - ) + () => import("~/scenes/Document/components/History") ); const DocumentInsights = React.lazy( - () => - import( - /* webpackChunkName: "document-insights" */ - "~/scenes/Document/components/Insights" - ) -); -const CommandBar = React.lazy( - () => - import( - /* webpackChunkName: "command-bar" */ - "~/components/CommandBar" - ) + () => import("~/scenes/Document/components/Insights") ); +const CommandBar = React.lazy(() => import("~/components/CommandBar")); const AuthenticatedLayout: React.FC = ({ children }) => { const { ui, auth } = useStores(); diff --git a/app/components/Editor.tsx b/app/components/Editor.tsx index cd85e1933a..6126ab07d6 100644 --- a/app/components/Editor.tsx +++ b/app/components/Editor.tsx @@ -30,13 +30,7 @@ import { sharedDocumentPath } from "~/utils/routeHelpers"; import { isHash } from "~/utils/urls"; import DocumentBreadcrumb from "./DocumentBreadcrumb"; -const LazyLoadedEditor = React.lazy( - () => - import( - /* webpackChunkName: "preload-shared-editor" */ - "~/editor" - ) -); +const LazyLoadedEditor = React.lazy(() => import("~/editor")); export type Props = Optional< EditorProps, diff --git a/app/components/IconPicker.tsx b/app/components/IconPicker.tsx index e434537004..252d1ad053 100644 --- a/app/components/IconPicker.tsx +++ b/app/components/IconPicker.tsx @@ -53,11 +53,7 @@ const style = { }; const TwitterPicker = React.lazy( - () => - import( - /* webpackChunkName: "twitter-picker" */ - "react-color/lib/components/twitter/Twitter" - ) + () => import("react-color/lib/components/twitter/Twitter") ); export const icons = { diff --git a/app/components/TableFromParams.tsx b/app/components/TableFromParams.tsx index d7a4c70556..20ab0391c4 100644 --- a/app/components/TableFromParams.tsx +++ b/app/components/TableFromParams.tsx @@ -5,13 +5,7 @@ import scrollIntoView from "smooth-scroll-into-view-if-needed"; import useQuery from "~/hooks/useQuery"; import type { Props } from "./Table"; -const Table = React.lazy( - () => - import( - /* webpackChunkName: "table" */ - "~/components/Table" - ) -); +const Table = React.lazy(() => import("~/components/Table")); const TableFromParams = ( props: Omit diff --git a/app/components/Time.tsx b/app/components/Time.tsx index 7f5f47df1c..144a4110e8 100644 --- a/app/components/Time.tsx +++ b/app/components/Time.tsx @@ -1,13 +1,7 @@ import { formatDistanceToNow } from "date-fns"; import * as React from "react"; -const LocaleTime = React.lazy( - () => - import( - /* webpackChunkName: "locale-time" */ - "~/components/LocaleTime" - ) -); +const LocaleTime = React.lazy(() => import("~/components/LocaleTime")); type Props = React.ComponentProps & { onClick?: () => void; diff --git a/app/index.tsx b/app/index.tsx index 59e59391cb..3f5ff9f4aa 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -119,10 +119,7 @@ window.addEventListener("load", async () => { return; } // https://github.com/googleanalytics/autotrack/issues/137#issuecomment-305890099 - await import( - /* webpackChunkName: "autotrack" */ - "autotrack/autotrack.js" - ); + await import("autotrack/autotrack.js"); window.ga("require", "outboundLinkTracker"); window.ga("require", "urlChangeTracker"); window.ga("require", "eventTracker", { diff --git a/app/routes/authenticated.tsx b/app/routes/authenticated.tsx index de5044715b..88d4096357 100644 --- a/app/routes/authenticated.tsx +++ b/app/routes/authenticated.tsx @@ -16,41 +16,11 @@ import useCurrentTeam from "~/hooks/useCurrentTeam"; import usePolicy from "~/hooks/usePolicy"; import { matchDocumentSlug as slug } from "~/utils/routeHelpers"; -const SettingsRoutes = React.lazy( - () => - import( - /* webpackChunkName: "settings" */ - "./settings" - ) -); -const Document = React.lazy( - () => - import( - /* webpackChunkName: "preload-document" */ - "~/scenes/Document" - ) -); -const Collection = React.lazy( - () => - import( - /* webpackChunkName: "collection" */ - "~/scenes/Collection" - ) -); -const Home = React.lazy( - () => - import( - /* webpackChunkName: "home" */ - "~/scenes/Home" - ) -); -const Search = React.lazy( - () => - import( - /* webpackChunkName: "search" */ - "~/scenes/Search" - ) -); +const SettingsRoutes = React.lazy(() => import("./settings")); +const Document = React.lazy(() => import("~/scenes/Document")); +const Collection = React.lazy(() => import("~/scenes/Collection")); +const Home = React.lazy(() => import("~/scenes/Home")); +const Search = React.lazy(() => import("~/scenes/Search")); const RedirectDocument = ({ match, diff --git a/app/routes/index.tsx b/app/routes/index.tsx index ca18945e3a..f5c6618f6e 100644 --- a/app/routes/index.tsx +++ b/app/routes/index.tsx @@ -6,41 +6,11 @@ import FullscreenLoading from "~/components/FullscreenLoading"; import Route from "~/components/ProfiledRoute"; import { matchDocumentSlug as slug } from "~/utils/routeHelpers"; -const Authenticated = React.lazy( - () => - import( - /* webpackChunkName: "preload-authenticated" */ - "~/components/Authenticated" - ) -); -const AuthenticatedRoutes = React.lazy( - () => - import( - /* webpackChunkName: "preload-authenticated-routes" */ - "./authenticated" - ) -); -const SharedDocument = React.lazy( - () => - import( - /* webpackChunkName: "shared-document" */ - "~/scenes/Document/Shared" - ) -); -const Login = React.lazy( - () => - import( - /* webpackChunkName: "login" */ - "~/scenes/Login" - ) -); -const Logout = React.lazy( - () => - import( - /* webpackChunkName: "logout" */ - "~/scenes/Logout" - ) -); +const Authenticated = React.lazy(() => import("~/components/Authenticated")); +const AuthenticatedRoutes = React.lazy(() => import("./authenticated")); +const SharedDocument = React.lazy(() => import("~/scenes/Document/Shared")); +const Login = React.lazy(() => import("~/scenes/Login")); +const Logout = React.lazy(() => import("~/scenes/Logout")); export default function Routes() { return ( diff --git a/app/scenes/Document/components/AsyncMultiplayerEditor.ts b/app/scenes/Document/components/AsyncMultiplayerEditor.ts index 661f97257c..f99c0c6eb8 100644 --- a/app/scenes/Document/components/AsyncMultiplayerEditor.ts +++ b/app/scenes/Document/components/AsyncMultiplayerEditor.ts @@ -1,11 +1,5 @@ import * as React from "react"; -const MultiplayerEditor = React.lazy( - () => - import( - /* webpackChunkName: "preload-multiplayer-editor" */ - "./MultiplayerEditor" - ) -); +const MultiplayerEditor = React.lazy(() => import("./MultiplayerEditor")); export default MultiplayerEditor; diff --git a/app/utils/polyfills.ts b/app/utils/polyfills.ts index 6f30abe193..d0563530aa 100644 --- a/app/utils/polyfills.ts +++ b/app/utils/polyfills.ts @@ -8,10 +8,7 @@ export async function loadPolyfills() { if (!supportsResizeObserver()) { polyfills.push( - import( - /* webpackChunkName: "resize-observer" */ - "@juggle/resize-observer" - ).then((module) => { + import("@juggle/resize-observer").then((module) => { window.ResizeObserver = module.ResizeObserver; }) ); diff --git a/shared/editor/plugins/Math.ts b/shared/editor/plugins/Math.ts index 24740c2603..9f0878ca87 100644 --- a/shared/editor/plugins/Math.ts +++ b/shared/editor/plugins/Math.ts @@ -18,10 +18,7 @@ export function createMathView(displayMode: boolean) { getPos: boolean | (() => number) ): MathView => { // dynamically load katex styles and fonts - import( - /* webpackChunkName: "katex" */ - "katex/dist/katex.min.css" - ); + import("katex/dist/katex.min.css"); const pluginState = MATH_PLUGIN_KEY.getState(view.state); if (!pluginState) { diff --git a/shared/editor/plugins/Mermaid.ts b/shared/editor/plugins/Mermaid.ts index 0048f05540..794619c20c 100644 --- a/shared/editor/plugins/Mermaid.ts +++ b/shared/editor/plugins/Mermaid.ts @@ -57,10 +57,7 @@ function getNewState({ return diagramWrapper; } - import( - /* webpackChunkName: "mermaid" */ - "mermaid" - ).then((module) => { + import("mermaid").then((module) => { module.default.initialize({ startOnLoad: true, flowchart: {