Repository: storybook
Issue: [Bug]: Storybook doesn't recover after fixing syntax error in stories file
Labels: bug,help wanted,has workaround,core,sev:S2

### Describe the bug

When making a syntax error in a .stories.tsx file, storybook crashes with the following error:

```
WARN 🚨 Unable to index files:
WARN - ./../project-name/src/Switch/Switch.mdx: Invariant failed: Could not find or load CSF file at path "./Switch.stories" referenced by `of={}` in docs file "../project-name/src/Switch/Switch.mdx".
WARN     
WARN - Does that file exist?
WARN - If so, is it a CSF file (`.stories.*`)?
WARN - If so, is it matched by the `stories` glob in `main.js`?
WARN - If so, has the file successfully loaded in Storybook and are its stories visible?
WARN - ./../project-name/src/Switch/Switch.stories.tsx: Unexpected token, expected "," (33:9)
37% building 1/2 entries 258/267 dependencies 458/127 modulesUnexpected token, expected "," (33:9)
No errors found.
```

After fixing the syntax error, storybook is unable to recover and shows a new error:

```
WARN 🚨 Unable to index ./../project-name/src/Switch/Switch.mdx:
WARN   Error: Invariant failed: Could not find or load CSF file at path "./Switch.stories" referenced by `of={}` in docs file "../project-name/src/Switch/Switch.mdx".
WARN     
WARN - Does that file exist?
WARN - If so, is it a CSF file (`.stories.*`)?
WARN - If so, is it matched by the `stories` glob in `main.js`?
WARN - If so, has the file successfully loaded in Storybook and are its stories visible?
WARN     at invariant (/Users/emlai/src/repo-name/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:14:11)
WARN     at StoryIndexGenerator.extractDocs (/Users/emlai/src/repo-name/node_modules/.pnpm/@storybook+core-server@7.4.0/node_modules/@storybook/core-server/dist/index.js:54:7829)
WARN     at async /Users/emlai/src/repo-name/node_modules/.pnpm/@storybook+core-server@7.4.0/node_modules/@storybook/core-server/dist/index.js:54:2052
WARN     at async Promise.all (index 15)
WARN     at async Promise.all (index 1)
WARN     at async StoryIndexGenerator.updateExtracted (/Users/emlai/src/repo-name/node_modules/.pnpm/@storybook+core-server@7.4.0/node_modules/@storybook/core-server/dist/index.js:54:1684)
WARN     at async StoryIndexGenerator.ensureExtracted (/Users/emlai/src/repo-name/node_modules/.pnpm/@storybook+core-server@7.4.0/node_modules/@storybook/core-server/dist/index.js:54:2641)
WARN     at async StoryIndexGenerator.getIndex (/Users/emlai/src/repo-name/node_modules/.pnpm/@storybook+core-server@7.4.0/node_modules/@storybook/core-server/dist/index.js:59:3620)
WARN     at async /Users/emlai/src/repo-name/node_modules/.pnpm/@storybook+core-server@7.4.0/node_modules/@storybook/core-server/dist/index.js:51:5264
No errors found.
```

The only solution is to restart storybook.

Some issues I observe:
- It's showing `WARN` and `No errors found.`, but seems like this should be an error, not a warning?
- When making the syntax error, `Invariant failed` shouldn't happen. Storybook should only report the syntax error e.g. `Unexpected token, expected ","`
- After fixing the syntax, `Invariant failed` shouldn't also happen. Storybook should recover and render without errors.


### To Reproduce

Create a storybook with an mdx file that imports a .stories.ts file, and make a syntax error in the stories file.

### System

```bash
System:
    OS: macOS 13.5
    CPU: (12) arm64 Apple M2 Pro
  Binaries:
    Node: 20.5.1 - /opt/homebrew/bin/node
    npm: 9.8.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 116.0.5845.179
    Safari: 16.6
```


### Additional context

_No response_