File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -608,14 +608,19 @@ export default defineNuxtModule<ModuleOptions>({
608608 }
609609 }
610610 // If Unhead cannot be resolved, retain the compatibility implementation.
611- const unheadPackagePath = await resolvePackageJSON ( '@unhead/vue' , {
612- // Match the package instance imported by the built runtime. An app can
613- // contain another Unhead version with different loader capabilities.
614- from : [ resolveModule ( './runtime' ) ] ,
615- } ) . catch ( ( ) => {
616- // @unhead /vue is optional; unresolved installs use the local compatibility path.
617- return null
618- } )
611+ const unheadScriptsAlias = nuxt . options . alias [ '@unhead/vue/scripts' ]
612+ const unheadPackagePath = await ( typeof unheadScriptsAlias === 'string'
613+ ? resolvePackageJSON ( unheadScriptsAlias )
614+ : Promise . reject ( new Error ( 'No Unhead scripts alias' ) ) )
615+ . catch ( ( ) => resolvePackageJSON ( '@unhead/vue' , {
616+ // Match the package instance imported by the built runtime. An app can
617+ // contain another Unhead version with different loader capabilities.
618+ from : [ resolveModule ( './runtime' ) ] ,
619+ } ) )
620+ . catch ( ( ) => {
621+ // @unhead /vue is optional; unresolved installs use the local compatibility path.
622+ return null
623+ } )
619624 const unheadPackage = unheadPackagePath
620625 ? await readPackageJSON ( unheadPackagePath ) . catch ( ( ) => {
621626 // An unreadable optional peer cannot safely advertise loader support.
You can’t perform that action at this time.
0 commit comments