Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev server stops when there are errors in the config file #2041

Closed
3 tasks done
sitek94 opened this issue Mar 6, 2023 · 1 comment
Closed
3 tasks done

Dev server stops when there are errors in the config file #2041

sitek94 opened this issue Mar 6, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@sitek94
Copy link

sitek94 commented Mar 6, 2023

Describe the bug

Development server stops working each time when you save the config file with a JavaScript error.

For example, if I save the following file, the development server stops and I need to restart it.

Screenshot 2023-03-06 at 20 17 42

[ERROR] Expected "]" but found ":"

    www/.vitepress/config.ts:7:9:
      7 │     hello: ''
        │          ^
        ╵          ]

failed to load config from /Users/maciek/code/vitepress-demo/www/.vitepress/config.ts

failed to restart server. error:
Error: Build failed with 1 error:
www/.vitepress/config.ts:7:9: ERROR: Expected "]" but found ":"
    at failureErrorWithLog (/Users/maciek/code/vitepress-demo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1604:15)
    at /Users/maciek/code/vitepress-demo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1056:28
    at runOnEndCallbacks (/Users/maciek/code/vitepress-demo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1476:61)
    at buildResponseToResult (/Users/maciek/code/vitepress-demo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1054:7)
    at /Users/maciek/code/vitepress-demo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1166:14
    at responseCallbacks.<computed> (/Users/maciek/code/vitepress-demo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:701:9)
    at handleIncomingPacket (/Users/maciek/code/vitepress-demo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:756:9)
    at Socket.readFromStdout (/Users/maciek/code/vitepress-demo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:677:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)

Reproduction

https://stackblitz.com/edit/vite-zsaqar?file=docs%2F.vitepress%2Fconfig.ts

  1. Start development server npm run docs:dev
  2. Paste the following code to .vitepress/config.ts
    import {defineConfig} from 'vitepress'
    
    export default defineConfig({
      title: 'My website',
      description: `My website description`,
      items: [
        hello: ''
      ],
    })
  3. Save the file
  4. Dev server should stop working, and you should see an error in the console

Expected behavior

  • development server shouldn't stop working
  • latest valid config should be used
  • maybe there should be an error overlay

System Info

System:
  OS: macOS 13.2.1
  CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Memory: 198.12 MB / 32.00 GB
  Shell: 5.8.1 - /bin/zsh
Binaries:
  Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node
  Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.0/bin/yarn
  npm: 8.19.2 - ~/.nvm/versions/node/v18.12.0/bin/npm
Browsers:
  Brave Browser: 107.1.45.116
  Chrome: 110.0.5481.177
  Firefox: 110.0
  Safari: 16.3
npmPackages:
  vitepress: 1.0.0-alpha.49 => 1.0.0-alpha.49

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@sitek94 sitek94 added the bug: pending triage Maybe a bug, waiting for confirmation label Mar 6, 2023
@brc-dd brc-dd added enhancement New feature or request and removed bug: pending triage Maybe a bug, waiting for confirmation labels Mar 6, 2023
@sitek94
Copy link
Author

sitek94 commented Mar 13, 2023

Thank you @yyx990803!

Btw. let me just say that this project is amazing and the design that we get out of the box is absolutely gorgeous!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants