Skip to content

Commit 67b573d

Browse files
committed
fix: PrimeVue nuxt module resolution
1 parent b69ff70 commit 67b573d

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/module.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from 'path'
22
import fs from 'fs'
33
import { spawn, type ChildProcess } from 'child_process'
4+
import { fileURLToPath } from 'url'
45
import { defineNuxtModule, createResolver, resolveFiles, addComponent, addImportsDir, extendPages } from '@nuxt/kit'
56
import type { NuxtPage, ModuleDependencies, NuxtModule } from '@nuxt/schema'
67
import { joinURL, withoutLeadingSlash, withoutTrailingSlash } from 'ufo'
@@ -61,9 +62,20 @@ const _module: NuxtModule<NuxtStoriesOptions> = defineNuxtModule<NuxtStoriesOpti
6162
'all'
6263

6364
if (mode === 'frame') return {}
65+
66+
// Resolve @primevue/nuxt-module from nuxt-stories' own node_modules so the
67+
// consuming app doesn't need to install it. Using an absolute path as the key
68+
// bypasses pnpm's strict isolation while still going through moduleDependencies.
69+
// import.meta.resolve follows ESM exports and returns the .mjs entry point.
70+
let primevuePath: string
71+
try {
72+
primevuePath = fileURLToPath(import.meta.resolve('@primevue/nuxt-module'))
73+
} catch {
74+
return {}
75+
}
76+
6477
return {
65-
'@primevue/nuxt-module': {
66-
version: '^4',
78+
[primevuePath]: {
6779
defaults: {
6880
autoImport: false,
6981
components: {

0 commit comments

Comments
 (0)