nolazy-chunks
This commit is contained in:
parent
4d8c5ef50b
commit
48226deeb5
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,3 +13,4 @@ pnpm-debug.log*
|
|||
.eslint/.eslintcache
|
||||
public/upload/*
|
||||
src/graphql/introspec.gen.ts
|
||||
stats.html
|
||||
|
|
|
@ -45,28 +45,48 @@ const astroConfig: AstroUserConfig = {
|
|||
vite: {
|
||||
build: {
|
||||
rollupOptions: {
|
||||
plugins: [visualizer()],
|
||||
output: {
|
||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||
manualChunks(id) {
|
||||
if (id.includes('node_modules')) {
|
||||
let chunkid = 'vendor'
|
||||
if (id.includes('shiki')) {
|
||||
chunkid = 'shiki'
|
||||
}
|
||||
if (id.includes('prismjs')) {
|
||||
chunkid = 'prismjs'
|
||||
}
|
||||
if (id.includes('acorn')) {
|
||||
chunkid = 'acorn'
|
||||
}
|
||||
if (id.includes('simple-peer')) {
|
||||
chunkid = 'simple-peer'
|
||||
}
|
||||
if (id.includes('prosemirror')) {
|
||||
chunkid = 'prosemirror'
|
||||
}
|
||||
if (id.includes('markdown')) {
|
||||
chunkid = 'markdown'
|
||||
}
|
||||
if (id.includes('remark') || id.includes('rehype')) {
|
||||
if (id.includes('swiper')) {
|
||||
chunkid = 'swiper'
|
||||
}
|
||||
if (id.includes('remark') || id.includes('rehype') || id.includes('micromark')) {
|
||||
chunkid = 'remark'
|
||||
}
|
||||
if (id.includes('yjs') || id.includes('y-')) {
|
||||
if (id.includes('parse5')) {
|
||||
chunkid = 'parse5'
|
||||
}
|
||||
if (
|
||||
id.includes('yjs') ||
|
||||
id.includes('y-prosemirror') ||
|
||||
id.includes('y-awareness') ||
|
||||
id.includes('y-protocols') ||
|
||||
id.includes('y-webrtc')
|
||||
) {
|
||||
chunkid = 'yjs'
|
||||
}
|
||||
if (id.includes('loglevel')) {
|
||||
chunkid = 'loglevel'
|
||||
}
|
||||
if (id.includes('nanostores')) {
|
||||
chunkid = 'nanostores'
|
||||
}
|
||||
return chunkid
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,31 +2,50 @@
|
|||
// import 'solid-devtools'
|
||||
|
||||
import { setLocale } from '../stores/ui'
|
||||
import { Component, createEffect, createMemo, lazy } from 'solid-js'
|
||||
import { Component, createEffect, createMemo } from 'solid-js'
|
||||
import { Routes, useRouter } from '../stores/router'
|
||||
import { Dynamic, isServer } from 'solid-js/web'
|
||||
import { getLogger } from '../utils/logger'
|
||||
|
||||
import type { PageProps } from './types'
|
||||
|
||||
const HomePage = lazy(() => import('./Pages/HomePage'))
|
||||
const AllTopicsPage = lazy(() => import('./Pages/AllTopicsPage'))
|
||||
const TopicPage = lazy(() => import('./Pages/TopicPage'))
|
||||
const AllAuthorsPage = lazy(() => import('./Pages/AllAuthorsPage'))
|
||||
const AuthorPage = lazy(() => import('./Pages/AuthorPage'))
|
||||
const FeedPage = lazy(() => import('./Pages/FeedPage'))
|
||||
const ArticlePage = lazy(() => import('./Pages/ArticlePage'))
|
||||
const SearchPage = lazy(() => import('./Pages/SearchPage'))
|
||||
const FourOuFourPage = lazy(() => import('./Pages/FourOuFourPage'))
|
||||
const DogmaPage = lazy(() => import('./Pages/about/DogmaPage'))
|
||||
const GuidePage = lazy(() => import('./Pages/about/GuidePage'))
|
||||
const HelpPage = lazy(() => import('./Pages/about/HelpPage'))
|
||||
const ManifestPage = lazy(() => import('./Pages/about/ManifestPage'))
|
||||
const PartnersPage = lazy(() => import('./Pages/about/PartnersPage'))
|
||||
const ProjectsPage = lazy(() => import('./Pages/about/ProjectsPage'))
|
||||
const TermsOfUsePage = lazy(() => import('./Pages/about/TermsOfUsePage'))
|
||||
const ThanksPage = lazy(() => import('./Pages/about/ThanksPage'))
|
||||
const CreatePage = lazy(() => import('./Pages/CreatePage'))
|
||||
import { HomePage } from './Pages/HomePage'
|
||||
import { AllTopicsPage } from './Pages/AllTopicsPage'
|
||||
import { TopicPage } from './Pages/TopicPage'
|
||||
import { AllAuthorsPage } from './Pages/AllAuthorsPage'
|
||||
import { AuthorPage } from './Pages/AuthorPage'
|
||||
import { FeedPage } from './Pages/FeedPage'
|
||||
import { ArticlePage } from './Pages/ArticlePage'
|
||||
import { SearchPage } from './Pages/SearchPage'
|
||||
import { FourOuFourPage } from './Pages/FourOuFourPage'
|
||||
import { DogmaPage } from './Pages/about/DogmaPage'
|
||||
import { GuidePage } from './Pages/about/GuidePage'
|
||||
import { HelpPage } from './Pages/about/HelpPage'
|
||||
import { ManifestPage } from './Pages/about/ManifestPage'
|
||||
import { PartnersPage } from './Pages/about/PartnersPage'
|
||||
import { ProjectsPage } from './Pages/about/ProjectsPage'
|
||||
import { TermsOfUsePage } from './Pages/about/TermsOfUsePage'
|
||||
import { ThanksPage } from './Pages/about/ThanksPage'
|
||||
import { CreatePage } from './Pages/CreatePage'
|
||||
|
||||
// TODO: lazy load
|
||||
// const HomePage = lazy(() => import('./Pages/HomePage'))
|
||||
// const AllTopicsPage = lazy(() => import('./Pages/AllTopicsPage'))
|
||||
// const TopicPage = lazy(() => import('./Pages/TopicPage'))
|
||||
// const AllAuthorsPage = lazy(() => import('./Pages/AllAuthorsPage'))
|
||||
// const AuthorPage = lazy(() => import('./Pages/AuthorPage'))
|
||||
// const FeedPage = lazy(() => import('./Pages/FeedPage'))
|
||||
// const ArticlePage = lazy(() => import('./Pages/ArticlePage'))
|
||||
// const SearchPage = lazy(() => import('./Pages/SearchPage'))
|
||||
// const FourOuFourPage = lazy(() => import('./Pages/FourOuFourPage'))
|
||||
// const DogmaPage = lazy(() => import('./Pages/about/DogmaPage'))
|
||||
// const GuidePage = lazy(() => import('./Pages/about/GuidePage'))
|
||||
// const HelpPage = lazy(() => import('./Pages/about/HelpPage'))
|
||||
// const ManifestPage = lazy(() => import('./Pages/about/ManifestPage'))
|
||||
// const PartnersPage = lazy(() => import('./Pages/about/PartnersPage'))
|
||||
// const ProjectsPage = lazy(() => import('./Pages/about/ProjectsPage'))
|
||||
// const TermsOfUsePage = lazy(() => import('./Pages/about/TermsOfUsePage'))
|
||||
// const ThanksPage = lazy(() => import('./Pages/about/ThanksPage'))
|
||||
|
||||
const log = getLogger('root')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user