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
|
.eslint/.eslintcache
|
||||||
public/upload/*
|
public/upload/*
|
||||||
src/graphql/introspec.gen.ts
|
src/graphql/introspec.gen.ts
|
||||||
|
stats.html
|
||||||
|
|
|
@ -45,28 +45,48 @@ const astroConfig: AstroUserConfig = {
|
||||||
vite: {
|
vite: {
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
|
plugins: [visualizer()],
|
||||||
output: {
|
output: {
|
||||||
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||||
manualChunks(id) {
|
manualChunks(id) {
|
||||||
if (id.includes('node_modules')) {
|
if (id.includes('node_modules')) {
|
||||||
let chunkid = 'vendor'
|
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')) {
|
if (id.includes('prosemirror')) {
|
||||||
chunkid = 'prosemirror'
|
chunkid = 'prosemirror'
|
||||||
}
|
}
|
||||||
if (id.includes('markdown')) {
|
if (id.includes('markdown')) {
|
||||||
chunkid = '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'
|
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'
|
chunkid = 'yjs'
|
||||||
}
|
}
|
||||||
if (id.includes('loglevel')) {
|
|
||||||
chunkid = 'loglevel'
|
|
||||||
}
|
|
||||||
if (id.includes('nanostores')) {
|
|
||||||
chunkid = 'nanostores'
|
|
||||||
}
|
|
||||||
return chunkid
|
return chunkid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,50 @@
|
||||||
// import 'solid-devtools'
|
// import 'solid-devtools'
|
||||||
|
|
||||||
import { setLocale } from '../stores/ui'
|
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 { Routes, useRouter } from '../stores/router'
|
||||||
import { Dynamic, isServer } from 'solid-js/web'
|
import { Dynamic, isServer } from 'solid-js/web'
|
||||||
import { getLogger } from '../utils/logger'
|
import { getLogger } from '../utils/logger'
|
||||||
|
|
||||||
import type { PageProps } from './types'
|
import type { PageProps } from './types'
|
||||||
|
|
||||||
const HomePage = lazy(() => import('./Pages/HomePage'))
|
import { HomePage } from './Pages/HomePage'
|
||||||
const AllTopicsPage = lazy(() => import('./Pages/AllTopicsPage'))
|
import { AllTopicsPage } from './Pages/AllTopicsPage'
|
||||||
const TopicPage = lazy(() => import('./Pages/TopicPage'))
|
import { TopicPage } from './Pages/TopicPage'
|
||||||
const AllAuthorsPage = lazy(() => import('./Pages/AllAuthorsPage'))
|
import { AllAuthorsPage } from './Pages/AllAuthorsPage'
|
||||||
const AuthorPage = lazy(() => import('./Pages/AuthorPage'))
|
import { AuthorPage } from './Pages/AuthorPage'
|
||||||
const FeedPage = lazy(() => import('./Pages/FeedPage'))
|
import { FeedPage } from './Pages/FeedPage'
|
||||||
const ArticlePage = lazy(() => import('./Pages/ArticlePage'))
|
import { ArticlePage } from './Pages/ArticlePage'
|
||||||
const SearchPage = lazy(() => import('./Pages/SearchPage'))
|
import { SearchPage } from './Pages/SearchPage'
|
||||||
const FourOuFourPage = lazy(() => import('./Pages/FourOuFourPage'))
|
import { FourOuFourPage } from './Pages/FourOuFourPage'
|
||||||
const DogmaPage = lazy(() => import('./Pages/about/DogmaPage'))
|
import { DogmaPage } from './Pages/about/DogmaPage'
|
||||||
const GuidePage = lazy(() => import('./Pages/about/GuidePage'))
|
import { GuidePage } from './Pages/about/GuidePage'
|
||||||
const HelpPage = lazy(() => import('./Pages/about/HelpPage'))
|
import { HelpPage } from './Pages/about/HelpPage'
|
||||||
const ManifestPage = lazy(() => import('./Pages/about/ManifestPage'))
|
import { ManifestPage } from './Pages/about/ManifestPage'
|
||||||
const PartnersPage = lazy(() => import('./Pages/about/PartnersPage'))
|
import { PartnersPage } from './Pages/about/PartnersPage'
|
||||||
const ProjectsPage = lazy(() => import('./Pages/about/ProjectsPage'))
|
import { ProjectsPage } from './Pages/about/ProjectsPage'
|
||||||
const TermsOfUsePage = lazy(() => import('./Pages/about/TermsOfUsePage'))
|
import { TermsOfUsePage } from './Pages/about/TermsOfUsePage'
|
||||||
const ThanksPage = lazy(() => import('./Pages/about/ThanksPage'))
|
import { ThanksPage } from './Pages/about/ThanksPage'
|
||||||
const CreatePage = lazy(() => import('./Pages/CreatePage'))
|
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')
|
const log = getLogger('root')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user