mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
refactor: remove unnecessary optional chaining (#1991)
This commit is contained in:
parent
4ba637a5ea
commit
a08b435f51
@ -42,7 +42,7 @@ export default defineComponent({
|
||||
const { $docus } = useContext()
|
||||
const route = useRoute()
|
||||
const currentSlug = computed(() => {
|
||||
return route.value.path !== '/' && route?.value?.params?.pathMatch
|
||||
return route.value.path !== '/' && route.value.params?.pathMatch
|
||||
? route.value.params.pathMatch.split('/')[0]
|
||||
: null
|
||||
})
|
||||
|
@ -20,7 +20,7 @@ export default defineComponent({
|
||||
const { $menu } = useContext()
|
||||
const route = useRoute()
|
||||
const currentSlug = computed(() => {
|
||||
return route.value.path !== '/' && route?.value?.params?.pathMatch
|
||||
return route.value.path !== '/' && route.value.params?.pathMatch
|
||||
? route.value.params.pathMatch.split('/')[0]
|
||||
: null
|
||||
})
|
||||
|
@ -74,5 +74,5 @@ export const useNuxtApp = () => {
|
||||
return currentNuxtAppInstance
|
||||
}
|
||||
|
||||
return vm?.proxy.$_nuxtApp
|
||||
return vm.proxy.$_nuxtApp
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
||||
prefix = 'nuxt'
|
||||
} else if (lastModule.startsWith(nitroContext._internal.runtimeDir)) {
|
||||
prefix = 'nitro'
|
||||
} else if (!prefix && nitroContext.middleware.find(m => lastModule.startsWith(m.handle as string))) {
|
||||
} else if (nitroContext.middleware.find(m => lastModule.startsWith(m.handle as string))) {
|
||||
prefix = 'middleware'
|
||||
} else if (lastModule.includes('assets')) {
|
||||
prefix = 'assets'
|
||||
|
@ -76,7 +76,7 @@ for (const [dirname, dirOpts] of Object.entries(dirs)) {
|
||||
}
|
||||
|
||||
function normalizeKey (key) {
|
||||
return key.replace(/[/\\\\]/g, ':').replace(/^:|:$/g, '')
|
||||
return key.replace(/[/\\]/g, ':').replace(/^:|:$/g, '')
|
||||
}
|
||||
|
||||
function getAssetProd (assets: Record<string, Asset>) {
|
||||
|
@ -44,7 +44,7 @@ export default defineNuxtCommand({
|
||||
const isNuxt3 = nuxtVersion.startsWith('3')
|
||||
const useVite = isNuxt3
|
||||
? nuxtConfig.vite !== false
|
||||
: (nuxtConfig?.buildModules?.find(m => m === 'nuxt-vite'))
|
||||
: (nuxtConfig.buildModules?.find(m => m === 'nuxt-vite'))
|
||||
|
||||
let packageManager = getPackageManager(rootDir)
|
||||
if (packageManager) {
|
||||
|
Loading…
Reference in New Issue
Block a user