diff --git a/app/components/Editor.tsx b/app/components/Editor.tsx index 88e12d791..06dbd0606 100644 --- a/app/components/Editor.tsx +++ b/app/components/Editor.tsx @@ -32,7 +32,7 @@ import DocumentBreadcrumb from "./DocumentBreadcrumb"; const LazyLoadedEditor = React.lazy( () => import( - /* webpackChunkName: "shared-editor" */ + /* webpackChunkName: "preload-shared-editor" */ "~/editor" ) ); diff --git a/app/routes/authenticated.tsx b/app/routes/authenticated.tsx index ebf4f5e3d..dbacc77da 100644 --- a/app/routes/authenticated.tsx +++ b/app/routes/authenticated.tsx @@ -26,7 +26,7 @@ const SettingsRoutes = React.lazy( const Document = React.lazy( () => import( - /* webpackChunkName: "document" */ + /* webpackChunkName: "preload-document" */ "~/scenes/Document" ) ); diff --git a/app/routes/index.tsx b/app/routes/index.tsx index cf13d7c16..f6069d93d 100644 --- a/app/routes/index.tsx +++ b/app/routes/index.tsx @@ -8,14 +8,14 @@ import { matchDocumentSlug as slug } from "~/utils/routeHelpers"; const Authenticated = React.lazy( () => import( - /* webpackChunkName: "authenticated" */ + /* webpackChunkName: "preload-authenticated" */ "~/components/Authenticated" ) ); const AuthenticatedRoutes = React.lazy( () => import( - /* webpackChunkName: "authenticated-routes" */ + /* webpackChunkName: "preload-authenticated-routes" */ "./authenticated" ) ); diff --git a/app/scenes/Document/components/AsyncMultiplayerEditor.ts b/app/scenes/Document/components/AsyncMultiplayerEditor.ts index bcaa354f7..661f97257 100644 --- a/app/scenes/Document/components/AsyncMultiplayerEditor.ts +++ b/app/scenes/Document/components/AsyncMultiplayerEditor.ts @@ -3,7 +3,7 @@ import * as React from "react"; const MultiplayerEditor = React.lazy( () => import( - /* webpackChunkName: "multiplayer-editor" */ + /* webpackChunkName: "preload-multiplayer-editor" */ "./MultiplayerEditor" ) ); diff --git a/server/utils/prefetchTags.tsx b/server/utils/prefetchTags.tsx index 1c69c03da..00b05bee3 100644 --- a/server/utils/prefetchTags.tsx +++ b/server/utils/prefetchTags.tsx @@ -28,7 +28,6 @@ try { // no-op } -let index = 0; Object.values(manifestData).forEach((filename) => { if (typeof filename !== "string") { return; @@ -43,18 +42,11 @@ Object.values(manifestData).forEach((filename) => { const shouldPreload = filename.includes("/main") || filename.includes("/runtime") || - filename.includes("/vendors"); - // only prefetch the first few javascript chunks or it gets out of hand fast - const shouldPrefetch = ++index <= 6; + filename.includes("preload-"); - if (shouldPreload || shouldPrefetch) { + if (shouldPreload) { prefetchTags.push( - + ); } } else if (filename.endsWith(".css")) {