File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 77 isNuxtMajorVersion ,
88 addImports ,
99 createResolver ,
10- resolveModule ,
1110 addImportsDir ,
1211} from '@nuxt/kit'
1312import type { NuxtModule } from '@nuxt/schema'
@@ -63,15 +62,14 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({
6362 // Transpile runtime
6463 nuxt . options . build . transpile . push ( resolve ( runtimeDir ) )
6564
66- // This alias broke in Nuxt 3 so only add it in Nuxt 2
67- if ( isNuxtMajorVersion ( 2 , nuxt ) ) {
68- // Make sure we use the mjs build for pinia
69- nuxt . options . alias . pinia =
70- nuxt . options . alias . pinia ||
71- // FIXME: remove this deprecated call. Ensure it works in Nuxt 2 to 3
72- resolveModule ( 'pinia/dist/pinia.mjs' , {
73- paths : [ nuxt . options . rootDir , import . meta. url ] ,
74- } )
65+ // dedupe pinia only if not building for SSR
66+ // https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/src/index.ts#L221
67+ if ( ! nuxt . options . vite ?. build ?. ssr ) {
68+ nuxt . options . vite . resolve ??= { }
69+ nuxt . options . vite . resolve . dedupe ??= [ ]
70+ if ( ! nuxt . options . vite . resolve . dedupe . includes ( 'pinia' ) ) {
71+ nuxt . options . vite . resolve . dedupe . push ( 'pinia' )
72+ }
7573 }
7674
7775 nuxt . hook ( 'prepare:types' , ( { references } ) => {
You can’t perform that action at this time.
0 commit comments