vite-plugin-checker icon indicating copy to clipboard operation
vite-plugin-checker copied to clipboard

Crash when starting vite dev server

Open matheusliraofficial opened this issue 2 years ago • 4 comments

Describe the bug

I've installed the vite-plugin-checker to use the typescript checker feature.

I added this config to my vite.config.ts

import checker from 'vite-plugin-checker'

defineConfig({
  plugins: [checker({ typescript: true })]
})

five seconds after I start my application, the server crashed and I got this error message:

events.js:377
      throw er; // Unhandled 'error' event
      ^
TypeError [Error]: Converting circular structure to JSON
    --> starting at object with constructor 'SourceFileObject'
    |     property 'statements' -> object with constructor 'Array'
    |     index 0 -> object with constructor 'NodeObject'
    --- property 'parent' closes the circle
    at JSON.stringify (<anonymous>)
    at getBuildInfoText (/Users/matheuslira/Projects/tableau/node_modules/typescript/lib/typescript.js:99937:21)
    at emitBuildInfo (/Users/matheuslira/Projects/tableau/node_modules/typescript/lib/typescript.js:99715:67)
    at emitSourceFileOrBundle (/Users/matheuslira/Projects/tableau/node_modules/typescript/lib/typescript.js:99680:13)
    at forEachEmittedFile (/Users/matheuslira/Projects/tableau/node_modules/typescript/lib/typescript.js:99434:28)
    at Object.emitFiles (/Users/matheuslira/Projects/tableau/node_modules/typescript/lib/typescript.js:99654:9)
    at Object.emitBuildInfo (/Users/matheuslira/Projects/tableau/node_modules/typescript/lib/typescript.js:106047:33)
    at Object.emitBuildInfo (/Users/matheuslira/Projects/tableau/node_modules/typescript/lib/typescript.js:109138:67)
    at Object.handleNoEmitOptions (/Users/matheuslira/Projects/tableau/node_modules/typescript/lib/typescript.js:107881:25)
    at Object.emit (/Users/matheuslira/Projects/tableau/node_modules/typescript/lib/typescript.js:109215:29)
Emitted 'error' event on process instance at:
    at emitUnhandledRejectionOrErr (internal/event_target.js:578:11)
    at MessagePort.[nodejs.internal.kHybridDispatch] (internal/event_target.js:403:9)
    at MessagePort.exports.emitMessage (internal/per_context/messageport.js:18:26)
error Command failed with exit code 1

Reproduction

Install vite-plugin-checker, enable the typescript checker at vite config file and run the vite dev server

Expected behavior

Show the typescript errors in my application without crashing the dev server

System Info

System:
    OS: macOS 12.3.1
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Memory: 1.26 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.5 - /usr/local/bin/node
    Yarn: 1.18.0 - ~/Projects/tableau/node_modules/.bin/yarn
    npm: 8.3.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 101.0.4951.64
    Firefox Nightly: 102.0a1
    Safari: 15.4

Additional context

TypeScript version 4.1.3

Validations

  • [X] Read the docs.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

matheusliraofficial avatar May 23 '22 14:05 matheusliraofficial

有解决方案了吗

Miofly avatar Jun 19 '22 14:06 Miofly

有解决方案了吗

Not yet...

matheusliraofficial avatar Jul 07 '22 01:07 matheusliraofficial

I can't make a repro on stackblitz(https://stackblitz.com/edit/vitejs-vite-zlgkhg?file=package.json), can you make one?

fi3ework avatar Jul 08 '22 15:07 fi3ework

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is a bug report, please provide a minimal re-production repository or use path to reproduce. Thank you for your contributions.

stale[bot] avatar Sep 06 '22 15:09 stale[bot]