Repository: storybook
Issue: [Bug]: parse_dammit ERROR on "Starting manager" stage
Labels: bug,needs triage

### Describe the bug

Error occured on "Starting manager" stage of Storybook installation procedure:
```
Running Storybook
yarn run v1.22.19
$ storybook dev -p 6006 --initial-path=/onboarding --quiet
@storybook/cli v7.4.1

info => Starting manager..
✘ [ERROR] "parse_dammit" is not declared in this file

    node_modules/acorn/dist/acorn.es.js:3401:55:
      3401 │ ...ersion, parse, parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports...
           ╵                                                 ~~~~~~~~~~~~

✘ [ERROR] "LooseParser" is not declared in this file

    node_modules/acorn/dist/acorn.es.js:3401:69:
      3401 │ ... parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plug...
           ╵                                                 ~~~~~~~~~~~

✘ [ERROR] "pluginsLoose" is not declared in this file

    node_modules/acorn/dist/acorn.es.js:3401:82:
      3401 │ ...ionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plugins, defaultO...
           ╵                                                 ~~~~~~~~~~~~

/home/haw0k/src/telemed-fe/node_modules/@storybook/cli/bin/index.js:23
  throw error;
  ^

Error: Build failed with 3 errors:
node_modules/acorn/dist/acorn.es.js:3401:55: ERROR: "parse_dammit" is not declared in this file
node_modules/acorn/dist/acorn.es.js:3401:69: ERROR: "LooseParser" is not declared in this file
node_modules/acorn/dist/acorn.es.js:3401:82: ERROR: "pluginsLoose" is not declared in this file
    at failureErrorWithLog (/home/haw0k/src/telemed-fe/node_modules/esbuild/lib/main.js:1649:15)
    at /home/haw0k/src/telemed-fe/node_modules/esbuild/lib/main.js:1058:25
    at /home/haw0k/src/telemed-fe/node_modules/esbuild/lib/main.js:1525:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: [
    {
      detail: undefined,
      id: '',
      location: {
        column: 55,
        file: 'node_modules/acorn/dist/acorn.es.js',
        length: 12,
        line: 3401,
        lineText: 'export { version, parse, parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plugins, defaultOptions, Position, SourceLocation, getLineInfo, Node, TokenType, tt as tokTypes, keywordTypes, TokContext, types as tokContexts, isIdentifierChar, isIdentifierStart, Token, isNewLine, lineBreak, lineBreakG };',
        namespace: '',
        suggestion: ''
      },
      notes: [],
      pluginName: '',
      text: '"parse_dammit" is not declared in this file'
    },
    {
      detail: undefined,
      id: '',
      location: {
        column: 69,
        file: 'node_modules/acorn/dist/acorn.es.js',
        length: 11,
        line: 3401,
        lineText: 'export { version, parse, parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plugins, defaultOptions, Position, SourceLocation, getLineInfo, Node, TokenType, tt as tokTypes, keywordTypes, TokContext, types as tokContexts, isIdentifierChar, isIdentifierStart, Token, isNewLine, lineBreak, lineBreakG };',
        namespace: '',
        suggestion: ''
      },
      notes: [],
      pluginName: '',
      text: '"LooseParser" is not declared in this file'
    },
    {
      detail: undefined,
      id: '',
      location: {
        column: 82,
        file: 'node_modules/acorn/dist/acorn.es.js',
        length: 12,
        line: 3401,
        lineText: 'export { version, parse, parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plugins, defaultOptions, Position, SourceLocation, getLineInfo, Node, TokenType, tt as tokTypes, keywordTypes, TokContext, types as tokContexts, isIdentifierChar, isIdentifierStart, Token, isNewLine, lineBreak, lineBreakG };',
        namespace: '',
        suggestion: ''
      },
      notes: [],
      pluginName: '',
      text: '"pluginsLoose" is not declared in this file'
    }
  ],
  warnings: []
}

Node.js v18.17.1
error Command failed with exit code 7.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

### To Reproduce

1. Vite react-ts project with following configs:
`vite.config.ts`
```
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import viteTsconfigPaths from "vite-tsconfig-paths";
import svgrPlugin from "vite-plugin-svgr";
import requireTransform from "vite-plugin-require-transform";

export default defineConfig({
  plugins: [react(), viteTsconfigPaths(), svgrPlugin(), requireTransform({})],
  server: {
    open: true,
    port: 3000,
  },
  build: {
    outDir: "build",
    commonjsOptions: {
      transformMixedEsModules: true,
    },
  },
  define: {
    global: "globalThis",
  },
});
```
`tsconfig.json`
```
{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "baseUrl": "./src",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "isolatedModules": true,
    "jsx": "react-jsx",
    "lib": ["dom", "dom.iterable", "esnext"],
    "module": "esnext",
    "moduleResolution": "node",
    "noEmit": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitReturns": true,
    "paths": {
      "assets/*": ["assets/*"],
      "components/*": ["components/*"],
      "hooks/*": ["hooks/*"],
      "interfaces/*": ["interfaces/*"],
      "messages/*": ["messages/*"],
      "pages/*": ["pages/*"],
      "routes/*": ["routes/*"],
      "schemas/*": ["schemas/*"],
      "services/*": ["services/*"],
      "store/*": ["store/*"],
      "types/*": ["types/*"],
      "utils/*": ["utils/*"],
      "views/*": ["views/*"]
    },
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "strict": true,
    "target": "ESNext",
    "types": ["vite/client"]
  },
  "include": ["src", "src/assets/index.d.ts"],
}
```
`.eslint.json`
```
{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": [
    "plugin:react/recommended",
    "plugin:react/jsx-runtime",
    "standard-with-typescript",
    "plugin:prettier/recommended",
    "plugin:storybook/recommended"
  ],
  "overrides": [
    {
      // or whatever matches stories specified in .storybook/main.js
      "files": ["*.stories.@(ts|tsx|js|jsx|mjs|cjs)"],
      "rules": {
        // example of overriding a rule
        "storybook/hierarchy-separator": "error",
        // example of disabling a rule
        "storybook/default-exports": "off"
      }
    }
  ],
  "parserOptions": {
    "ecmaVersion": "latest",
    "sourceType": "module",
    "project": ["./tsconfig.json"],
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "plugins": ["react", "prettier"],
  "rules": {
    "linebreak-style": "off",
    "quotes": ["error", "double", { "avoidEscape": true }],
    "prettier/prettier": [
      "error",
      {
        "singleAttributePerLine": false,
        "endOfLine": "auto"
      }
    ],
    "react/jsx-uses-react": "error",
    "react/jsx-uses-vars": "error",
    "sort-imports": [
      "error",
      {
        "ignoreCase": false,
        "ignoreDeclarationSort": true,
        "ignoreMemberSort": false,
        "memberSyntaxSortOrder": ["multiple", "single", "all", "none"],
        "allowSeparatedGroups": false
      }
    ],
    "@typescript-eslint/explicit-function-return-type": "off",
    "@typescript-eslint/triple-slash-reference": "off",
    "@typescript-eslint/strict-boolean-expressions": "off",
    "@typescript-eslint/no-confusing-void-expression": "off",
    "no-debugger": "off",
    "@typescript-eslint/restrict-template-expressions": "off",
    "@typescript-eslint/prefer-nullish-coalescing": "off"
  },
  "settings": {
    "react": {
      "version": "18.2.0"
    }
  },
  "ignorePatterns": ["vite.config.ts"]
}
```
`package.json'
```
{
  "name": "test-ts",
  "version": "0.1.0",
  "license": "UNLICENSED",
  "private": true,
  "dependencies": {
    "@chakra-ui/icons": "^2.0.19",
    "@chakra-ui/react": "2.6.1",
    "@choc-ui/chakra-autocomplete": "^5.1.5",
    "@emotion/react": "^11.11.0",
    "@emotion/styled": "^11.11.0",
    "@fontsource/roboto": "^5.0.1",
    "@opentok/client": "^2.25.3",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^13.0.0",
    "@testing-library/user-event": "^13.2.1",
    "@types/jest": "^29.4.0",
    "@types/node": "^18.14.5",
    "@types/react": "^18.2.7",
    "@types/react-dom": "^18.2.4",
    "@vitejs/plugin-react-swc": "^3.3.2",
    "chakra-dayzed-datepicker": "^0.2.8",
    "chakra-react-select": "^4.7.2",
    "countries-list": "^2.6.1",
    "date-fns": "^2.30.0",
    "dayzed": "^3.2.3",
    "env-cmd": "^10.1.0",
    "formik": "^2.4.2",
    "framer-motion": "^7.1.0",
    "highcharts": "^11.1.0",
    "highcharts-react-official": "^3.2.0",
    "html2canvas": "^1.4.1",
    "jwt-decode": "^3.1.2",
    "ky": "^0.33.3",
    "lodash": "^4.17.21",
    "luxon": "^3.4.2",
    "mobx": "^6.9.0",
    "mobx-devtools-mst": "^0.9.30",
    "mobx-react-lite": "^3.4.3",
    "mobx-state-tree": "^5.1.8",
    "nanoid": "^4.0.2",
    "opentok-layout-js": "^5.2.2",
    "opentok-network-test-js": "^3.1.1",
    "print-js": "^1.6.0",
    "react": "^18.2.0",
    "react-dnd": "^16.0.1",
    "react-dnd-html5-backend": "^16.0.1",
    "react-dom": "^18.2.0",
    "react-dropzone": "^14.2.3",
    "react-google-recaptcha": "^2.1.0",
    "react-icons": "^4.9.0",
    "react-qr-code": "^2.0.12",
    "react-quill": "^2.0.0",
    "react-router-dom": "^6.11.2",
    "react-table": "^7.8.0",
    "three": "0.109.0",
    "typescript": "4.9.5",
    "vite": "^4.4.9",
    "vite-plugin-svgr": "^3.2.0",
    "vite-tsconfig-paths": "^4.2.1",
    "web-vitals": "^2.1.0",
    "yup": "^0.32.11"
  },
  "scripts": {
    "start": "vite",
    "build": "vite build",
    "build:alpha": "vite build --mode alpha",
    "build:beta": "vite build --mode beta",
    "build:prod": "vite build",
    "format": "prettier --write 'src/**/*.ts{,x}'",
    "lint": "tsc --noEmit && eslint src/**/*.ts{,x}",
    "lint-fix": "tsc --noEmit && eslint --fix src/**/*.ts{,x}",
    "documentation": "./node_modules/.bin/jsdoc -c ./jsdoc.json"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@chargebee/chargebee-js-types": "^1.0.1",
    "@types/luxon": "^3.3.2",
    "@types/react-google-recaptcha": "^2.1.5",
    "@types/react-table": "^7.7.14",
    "@types/three": "^0.149.0",
    "@typescript-eslint/eslint-plugin": "^5.54.0",
    "@typescript-eslint/parser": "^5.54.0",
    "babel-plugin-named-exports-order": "^0.0.2",
    "better-docs": "^2.7.2",
    "eslint": "^8.35.0",
    "eslint-config-airbnb": "19.0.4",
    "eslint-config-airbnb-typescript": "^17.0.0",
    "eslint-config-prettier": "^8.6.0",
    "eslint-config-standard-with-typescript": "^27.0.1",
    "eslint-plugin-import": "^2.27.5",
    "eslint-plugin-jest": "^27.2.1",
    "eslint-plugin-jsdoc": "^40.0.1",
    "eslint-plugin-jsx-a11y": "^6.7.1",
    "eslint-plugin-n": "^15.6.1",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-promise": "^6.1.1",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-storybook": "^0.6.11",
    "jsdoc": "^3.6.11",
    "mst-middlewares": "^5.1.8",
    "prettier": "^2.8.8",
    "prop-types": "^15.8.1",
    "remotedev": "^0.2.9",
    "tsconfig-paths": "^4.1.2",
    "vite-plugin-require-transform": "^1.0.21"
  },
  "eslintConfig": {
    "overrides": [
      {
        "files": [
          "**/*.stories.*"
        ],
        "rules": {
          "import/no-anonymous-default-export": "off"
        }
      }
    ]
  },
  "resolutions": {
    "jackspeak": "2.1.1"
  }
}
```
2. Run `npx storybook@latest init`
3. Get error.
### System

linux x64, NodeJS 18.17.1

### Additional context

```
$ npx storybook@latest init
Need to install the following packages:
  storybook@7.4.1
Ok to proceed? (y)
npm WARN deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm WARN deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm WARN deprecated @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.

 storybook init - the simplest way to add a Storybook to your project.

 • Detecting project type. ✓
 • Preparing to install dependencies. ✓


yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.22s.
. ✓
 • Adding Storybook support to your "React" app • Detected Vite project. Setting builder to Vite. ✓

  ✔ Getting the correct version of 9 packages
  ✔ Installing Storybook dependencies
. ✓
 • Preparing to install dependencies. ✓


yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.32s.
. ✓
╭──────────────────────────────────────────────────────────────────────────────╮
│                                                                              │
│   Storybook was successfully installed in your project! 🎉                   │
│   To run Storybook manually, run yarn storybook. CTRL+C to stop.             │
│                                                                              │
│   Wanna know more about Storybook? Check out https://storybook.js.org/       │
│   Having trouble or want to chat? Join us at https://discord.gg/storybook/   │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Running Storybook
yarn run v1.22.19
$ storybook dev -p 6006 --initial-path=/onboarding --quiet
@storybook/cli v7.4.1

info => Starting manager..
✘ [ERROR] "parse_dammit" is not declared in this file

    node_modules/acorn/dist/acorn.es.js:3401:55:
      3401 │ ...ersion, parse, parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports...
           ╵                                                 ~~~~~~~~~~~~

✘ [ERROR] "LooseParser" is not declared in this file

    node_modules/acorn/dist/acorn.es.js:3401:69:
      3401 │ ... parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plug...
           ╵                                                 ~~~~~~~~~~~

✘ [ERROR] "pluginsLoose" is not declared in this file

    node_modules/acorn/dist/acorn.es.js:3401:82:
      3401 │ ...ionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plugins, defaultO...
           ╵                                                 ~~~~~~~~~~~~

/home/haw0k/src/telemed-fe/node_modules/@storybook/cli/bin/index.js:23
  throw error;
  ^

Error: Build failed with 3 errors:
node_modules/acorn/dist/acorn.es.js:3401:55: ERROR: "parse_dammit" is not declared in this file
node_modules/acorn/dist/acorn.es.js:3401:69: ERROR: "LooseParser" is not declared in this file
node_modules/acorn/dist/acorn.es.js:3401:82: ERROR: "pluginsLoose" is not declared in this file
    at failureErrorWithLog (/home/haw0k/src/telemed-fe/node_modules/esbuild/lib/main.js:1649:15)
    at /home/haw0k/src/telemed-fe/node_modules/esbuild/lib/main.js:1058:25
    at /home/haw0k/src/telemed-fe/node_modules/esbuild/lib/main.js:1525:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: [
    {
      detail: undefined,
      id: '',
      location: {
        column: 55,
        file: 'node_modules/acorn/dist/acorn.es.js',
        length: 12,
        line: 3401,
        lineText: 'export { version, parse, parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plugins, defaultOptions, Position, SourceLocation, getLineInfo, Node, TokenType, tt as tokTypes, keywordTypes, TokContext, types as tokContexts, isIdentifierChar, isIdentifierStart, Token, isNewLine, lineBreak, lineBreakG };',
        namespace: '',
        suggestion: ''
      },
      notes: [],
      pluginName: '',
      text: '"parse_dammit" is not declared in this file'
    },
    {
      detail: undefined,
      id: '',
      location: {
        column: 69,
        file: 'node_modules/acorn/dist/acorn.es.js',
        length: 11,
        line: 3401,
        lineText: 'export { version, parse, parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plugins, defaultOptions, Position, SourceLocation, getLineInfo, Node, TokenType, tt as tokTypes, keywordTypes, TokContext, types as tokContexts, isIdentifierChar, isIdentifierStart, Token, isNewLine, lineBreak, lineBreakG };',
        namespace: '',
        suggestion: ''
      },
      notes: [],
      pluginName: '',
      text: '"LooseParser" is not declared in this file'
    },
    {
      detail: undefined,
      id: '',
      location: {
        column: 82,
        file: 'node_modules/acorn/dist/acorn.es.js',
        length: 12,
        line: 3401,
        lineText: 'export { version, parse, parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plugins, defaultOptions, Position, SourceLocation, getLineInfo, Node, TokenType, tt as tokTypes, keywordTypes, TokContext, types as tokContexts, isIdentifierChar, isIdentifierStart, Token, isNewLine, lineBreak, lineBreakG };',
        namespace: '',
        suggestion: ''
      },
      notes: [],
      pluginName: '',
      text: '"pluginsLoose" is not declared in this file'
    }
  ],
  warnings: []
}

Node.js v18.17.1
error Command failed with exit code 7.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```