Skip to content

Commit 71bea4d

Browse files
authored
Merge pull request #259 from xuewenG/feature/icon-client-bundle
不通过远程获取 icon,把 icon 打包在产物中,提升加载速度
2 parents 205ed6b + e3d9e21 commit 71bea4d

File tree

3 files changed

+88
-20
lines changed

3 files changed

+88
-20
lines changed

front/nuxt.config.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
export default defineNuxtConfig({
33
compatibilityDate: '2024-04-03',
44
devtools: {enabled: false},
5-
modules: ["@nuxt/ui", '@vueuse/nuxt', 'dayjs-nuxt'],
5+
modules: ["@nuxt/ui", '@nuxt/icon', '@vueuse/nuxt', 'dayjs-nuxt'],
66
ssr: false,
77
dayjs: {
88
locales: ['zh'],
99
defaultLocale: 'zh'
1010
},
11-
ui: {
12-
icons: ['carbon']
11+
icon: {
12+
clientBundle: {
13+
scan: {
14+
globInclude: ['**/*.{vue,jsx,tsx}', 'node_modules/@nuxt/ui/**/*.js'],
15+
globExclude: ['.*', 'coverage', 'test', 'tests', 'dist', 'build'],
16+
},
17+
},
1318
},
1419
tailwindcss: {
1520
safelist: [
@@ -44,7 +49,6 @@ export default defineNuxtConfig({
4449
"/api": {
4550
target: "http://localhost:37892",
4651
changeOrigin: true,
47-
// rewrite: (path) => path.replace(/^\/api/, ""),
4852
},
4953
"/upload": {
5054
target: "http://localhost:37892",

front/package.json

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
"dependencies": {
1313
"@fancyapps/ui": "^5.0.36",
1414
"@iconify-json/carbon": "^1.1.37",
15+
"@iconify-json/heroicons": "^1.2.2",
16+
"@iconify-json/icon-park-solid": "^1.2.2",
17+
"@iconify-json/jam": "^1.2.2",
18+
"@iconify-json/lets-icons": "^1.2.1",
19+
"@iconify-json/octicon": "^1.2.2",
20+
"@iconify-json/solar": "^1.2.2",
21+
"@nuxt/icon": "1.10.3",
1522
"@nuxt/ui": "^2.18.7",
1623
"date-fns": "^3.6.0",
1724
"markdown-it": "^14.1.0",

front/pnpm-lock.yaml

+73-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)