Repository: storybook
Issue: [Bug]: main.ts/stories[0] can't contain more than one app (Cannot read properties of undefined (reading 'toLowerCase'))
Labels: bug,needs triage

### Describe the bug

### Project (cd web + sb init)

```
apps
|-- docs
|-- |-- package.json
|-- web
|-- |-- .storybook/main.ts
|-- |-- src/stories
|-- |-- package.json
```

### Works

```js
// .storybook/main.ts
stories: [
    {
      // 👇 Sets the directory containing your stories
      directory: '../../../apps/docs',
      // 👇 Storybook will load all files that match this glob
      files: '**/*.@(mdx|stories.@(mdx|js|jsx|mjs|ts|tsx))',
      // 👇 Used when generating automatic titles for your stories
      titlePrefix: 'MyComponents'
    },
    {
      // 👇 Sets the directory containing your stories
      directory: '../../../apps/web',
      // 👇 Storybook will load all files that match this glob
      files: '**/*.@(mdx|stories.@(mdx|js|jsx|mjs|ts|tsx))',
      // 👇 Used when generating automatic titles for your stories
      titlePrefix: 'MyComponents'
    }
]
```

or `stories: ['../../../apps/docs/**/*.mdx', '../../../apps/web/**/*.mdx']`

Output:

```js

info => Starting manager..
WARN No story files found for the specified pattern: ../docs/**/*.@(mdx|stories.@(mdx|js|jsx|mjs|ts|tsx))
The following Vite config options will be overridden by SvelteKit:
  - base

Unexpected 'default'. Parameter 'options.storySort' should be defined inline e.g.:

export default {
  parameters: {
    options: {
      storySort: <array | object | function>
    },
  },
};
 (x2)
╭───────────────────────────────────────────────────╮
│                                                   │
│   Storybook 7.1.0 for sveltekit started           │
│   165 ms for manager and 809 ms for preview       │
│                                                   │
│    Local:            http://localhost:6006/       │
│    On your network:  http://192.168.1.18:6006/    │
│                                                   │
╰───────────────────────────────────────────────────╯
```

### Not works

```js
stories: [
    {
      // 👇 Sets the directory containing your stories
      directory: '../../../apps',
      // 👇 Storybook will load all files that match this glob
      files: '**/*.@(mdx|stories.@(mdx|js|jsx|mjs|ts|tsx))',
      // 👇 Used when generating automatic titles for your stories
      titlePrefix: 'MyComponents'
    }
]
```

or `stories: ['../../../apps/*/**/*.mdx']`
or `stories: ['../../../apps/*/src/**/*.mdx']`

Output:

```js

@storybook/cli v7.1.0

info => Starting manager..
The following Vite config options will be overridden by SvelteKit:
  - base

WARN 🚨 Unable to index files:
WARN - ./src/stories/Button.stories.ts: Cannot read properties of undefined (reading 'toLowerCase')
WARN - ./src/stories/Configure.mdx: Cannot read properties of undefined (reading 'toLowerCase')
WARN - ./src/stories/Header.stories.ts: Cannot read properties of undefined (reading 'toLowerCase')
WARN - ./src/stories/Page.stories.ts: Cannot read properties of undefined (reading 'toLowerCase')
 (x2)
```

### To Reproduce

_No response_

### System

_No response_

### Additional context

https://github.com/storybookjs/storybook/issues/8554