Commit 5fad6542f1
Unsigned
Layout: unified · split
docs/.vitepress/configs/index.ts +25 −1
| @@ -11,6 +11,7 @@ import { | |||
| 11 | } from '@nolebase/vitepress-plugin-page-properties/vite' | 11 | } from '@nolebase/vitepress-plugin-page-properties/vite' |
| 12 | import { fileURLToPath, URL } from 'node:url' | 12 | import { fileURLToPath, URL } from 'node:url' |
| 13 | import UnoCSS from 'unocss/vite' | 13 | import UnoCSS from 'unocss/vite' |
| 14 | import { createLogger } from 'vite' | ||
| 14 | import Devtools from 'vite-plugin-vue-devtools' | 15 | import Devtools from 'vite-plugin-vue-devtools' |
| 15 | import type { DefaultTheme, Plugin, UserConfig } from 'vitepress' | 16 | import type { DefaultTheme, Plugin, UserConfig } from 'vitepress' |
| 16 | import { hostname, sidebar, siteConfig } from './constants' | 17 | import { hostname, sidebar, siteConfig } from './constants' |
| @@ -19,6 +20,25 @@ import { configureMarkdown } from './markdown' | |||
| 19 | import { aliases, defs, movePlugin } from './markdown/emoji' | 20 | import { aliases, defs, movePlugin } from './markdown/emoji' |
| 20 | import { collectPageLinks, urlSearchDevPlugin, writeUrlSearchIndex } from '../plugins/urlSearchPlugin' | 21 | import { collectPageLinks, urlSearchDevPlugin, writeUrlSearchIndex } from '../plugins/urlSearchPlugin' |
| 21 | 22 | ||
| 23 | const logger = createLogger() | ||
| 24 | const warn = logger.warn | ||
| 25 | const warnOnce = logger.warnOnce | ||
| 26 | |||
| 27 | function shouldSuppressWarning(message: string) { | ||
| 28 | return message.includes('[lightningcss minify] Unknown at rule: @property') || | ||
| 29 | message.includes('Some chunks are larger than') | ||
| 30 | } | ||
| 31 | |||
| 32 | logger.warn = (message, options) => { | ||
| 33 | if (shouldSuppressWarning(message)) return | ||
| 34 | warn(message, options) | ||
| 35 | } | ||
| 36 | |||
| 37 | logger.warnOnce = (message, options) => { | ||
| 38 | if (shouldSuppressWarning(message)) return | ||
| 39 | warnOnce(message, options) | ||
| 40 | } | ||
| 41 | |||
| 22 | const GIT_COMMIT = process.env.NODE_ENV === 'development' | 42 | const GIT_COMMIT = process.env.NODE_ENV === 'development' |
| 23 | ? 'dev' | 43 | ? 'dev' |
| 24 | : (process.env.GITHUB_SHA ?? | 44 | : (process.env.GITHUB_SHA ?? |
| @@ -89,9 +109,13 @@ export const shared: UserConfig<DefaultTheme.Config> = { | |||
| 89 | } | 109 | } |
| 90 | }, | 110 | }, |
| 91 | vite: { | 111 | vite: { |
| 112 | customLogger: logger, | ||
| 92 | experimental: { | 113 | experimental: { |
| 93 | enableNativePlugin: true | 114 | enableNativePlugin: true |
| 94 | }, | 115 | }, |
| 116 | build: { | ||
| 117 | cssMinify: 'lightningcss' | ||
| 118 | }, | ||
| 95 | optimizeDeps: { | 119 | optimizeDeps: { |
| 96 | exclude: [ | 120 | exclude: [ |
| 97 | '@nolebase/vitepress-plugin-enhanced-readabilities/client', | 121 | '@nolebase/vitepress-plugin-enhanced-readabilities/client', |
| @@ -149,4 +173,4 @@ export const shared: UserConfig<DefaultTheme.Config> = { | |||
| 149 | ] | 173 | ] |
| 150 | } | 174 | } |
| 151 | } | 175 | } |
| 152 | }\ No newline at end of file | 176 | } |
unocss.config.ts +2 −2
| @@ -99,7 +99,7 @@ export default defineConfig({ | |||
| 99 | 'vertical-align': '-0.125em', // changed from 'middle' | 99 | 'vertical-align': '-0.125em', // changed from 'middle' |
| 100 | 'min-width': '1.2rem' | 100 | 'min-width': '1.2rem' |
| 101 | }, | 101 | }, |
| 102 | warn: true, | 102 | warn: false, |
| 103 | collections: { | 103 | collections: { |
| 104 | custom: FileSystemIconLoader(resolve(__dirname, 'docs/public/custom')), | 104 | custom: FileSystemIconLoader(resolve(__dirname, 'docs/public/custom')), |
| 105 | inline: customIcons | 105 | inline: customIcons |
| @@ -107,4 +107,4 @@ export default defineConfig({ | |||
| 107 | }) | 107 | }) |
| 108 | ], | 108 | ], |
| 109 | transformers: [transformerDirectives()] | 109 | transformers: [transformerDirectives()] |
| 110 | })\ No newline at end of file | 110 | }) |