Skip to content

Commit e8c4c8b

Browse files
committed
build: embed PrimeVue only for the shell app
1 parent a257dfc commit e8c4c8b

1 file changed

Lines changed: 20 additions & 24 deletions

File tree

src/module.ts

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import path from 'path'
22
import fs from 'fs'
33
import { spawn, type ChildProcess } from 'child_process'
4-
54
import { defineNuxtModule, createResolver, resolveFiles, addComponent, addImportsDir, extendPages } from '@nuxt/kit'
65
import type { NuxtPage } from '@nuxt/schema'
76
import { joinURL, withoutLeadingSlash, withoutTrailingSlash } from 'ufo'
@@ -55,22 +54,29 @@ export default defineNuxtModule<NuxtStoriesOptions>({
5554
mode: 'all',
5655
framePort: 3000,
5756
},
58-
moduleDependencies: {
59-
'@primevue/nuxt-module': {
60-
version: '^4',
61-
defaults: {
62-
autoImport: false,
63-
components: {
64-
prefix: 'pv',
65-
include: ['Tree', 'Button', 'InputText', 'Splitter', 'SplitterPanel', 'Toolbar', 'Menu'],
66-
},
67-
options: {
68-
theme: {
69-
preset: Aura,
57+
moduleDependencies(nuxt) {
58+
const mode =
59+
(process.env.NUXT_STORIES_MODE as string | undefined) ||
60+
(nuxt.options as unknown as { stories?: { mode?: string } }).stories?.mode ||
61+
'all'
62+
if (mode === 'frame') return {}
63+
return {
64+
'@primevue/nuxt-module': {
65+
version: '^4',
66+
defaults: {
67+
autoImport: false,
68+
components: {
69+
prefix: 'pv',
70+
include: ['Tree', 'Button', 'InputText', 'Splitter', 'SplitterPanel', 'Toolbar', 'Menu'],
71+
},
72+
options: {
73+
theme: {
74+
preset: Aura,
75+
},
7076
},
7177
},
7278
},
73-
},
79+
}
7480
},
7581
async setup(options, nuxt) {
7682
if (!options.enabled) return
@@ -113,16 +119,6 @@ export default defineNuxtModule<NuxtStoriesOptions>({
113119
? `http://localhost:${options.framePort ?? 3000}`
114120
: undefined
115121

116-
// // Alias primevue to the module's own node_modules so runtime components
117-
// // can import from 'primevue/...' without requiring the consuming app to install it.
118-
// const primeVueDir = path.dirname(
119-
// resolveModule('primevue/package.json', { paths: [resolver.resolve('.')] }),
120-
// )
121-
// nuxt.options.alias['primevue'] = primeVueDir
122-
123-
// // Register the PrimeVue shell plugin (unstyled, no CSS contamination)
124-
// addPlugin(resolver.resolve('./runtime/plugins/primevue'))
125-
126122
// Expose base paths so runtime composables can compute URLs dynamically
127123
nuxt.options.runtimeConfig.public.nuxtStories = {
128124
routeBasePath,

0 commit comments

Comments
 (0)