Skip to content

Commit f3403eb

Browse files
danielroeantfu
andauthored
perf: only load vue-data-ui css in components that use it (#1918)
Co-authored-by: Anthony Fu <github@antfu.me>
1 parent 6a44d71 commit f3403eb

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

app/components/Package/TrendsChart.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import { applyDataCorrection } from '~/utils/chart-data-correction'
2222
import { applyBlocklistCorrection, getAnomaliesForPackages } from '~/utils/download-anomalies'
2323
import { copyAltTextForTrendLineChart } from '~/utils/charts'
2424
25+
import('vue-data-ui/style.css')
26+
2527
const props = withDefaults(
2628
defineProps<{
2729
// For single package downloads history

app/components/Package/VersionDistribution.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
import TooltipApp from '~/components/Tooltip/App.vue'
1212
import { copyAltTextForVersionsBarChart } from '~/utils/charts'
1313
14+
import('vue-data-ui/style.css')
15+
1416
const props = defineProps<{
1517
packageName: string
1618
inModal?: boolean

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import type { RepoRef } from '#shared/utils/git-providers'
99
import type { VueUiSparklineConfig, VueUiSparklineDatasetItem } from 'vue-data-ui'
1010
import { onKeyDown } from '@vueuse/core'
1111
12+
import('vue-data-ui/style.css')
13+
1214
const props = defineProps<{
1315
packageName: string
1416
createdIso: string | null

nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default defineNuxtConfig({
3131
storageKey: 'npmx-color-mode',
3232
},
3333

34-
css: ['~/assets/main.css', 'vue-data-ui/style.css'],
34+
css: ['~/assets/main.css'],
3535

3636
runtimeConfig: {
3737
sessionPassword: '',

0 commit comments

Comments
 (0)