fi3ework / vite-plugin-checker

💬 Vite plugin that provide checks of TypeScript, ESLint, vue-tsc, Stylelint and more.
https://vite-plugin-checker.netlify.app
MIT License
1k stars 87 forks source link

Plugin hangs when using vite optimize #227

Open stryaponoff opened 1 year ago

stryaponoff commented 1 year ago

Describe the bug

When I execute vite optimize command, it will never return input to user in terminal. If I disable the vite-plugin-checker, all works fine

Reproduction

  1. Add vite-plugin-checker to Vite config according to documentation
  2. Run vite optimize in Terminal, ensure it hangs
  3. Press Ctrl+C to terminate the task
  4. Remove vite-plugin-checker from plugins section in config
  5. Run vite optimize in Terminal, all works fine

Expected behavior

The plugin should not break optimize command

System Info

System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 84.47 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.13.0 - ~/Library/Caches/fnm_multishells/44541_1677732897634/bin/node
    Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/44541_1677732897634/bin/yarn
    npm: 9.5.1 - ~/Library/Caches/fnm_multishells/44541_1677732897634/bin/npm
  Browsers:
    Chrome: 110.0.5481.177
    Firefox: 108.0.2
    Safari: 16.3

Additional context

No response

Validations

janein commented 1 year ago

For me this happens on vite build as soon as I activate eslint checking.

stryaponoff commented 1 year ago

Here's my plugin config, no issues with vite build, by the way.

checker({
  typescript: true,
  eslint: {
    lintCommand: 'eslint "./src/**/*.{ts,vue}"',
  },
  terminal: true,
  overlay: true,
  enableBuild: false,
}),
stryaponoff commented 1 year ago

I've made a repo that reproduces this issue. Hope it helps.

It contains two commands: yarn optimize:broken hangs while yarn optimize:working is working. Please note that the config files is the only difference and the only difference in configs is this plugin.

It's build over clean yarn create vite Vue project

jfairley commented 1 year ago

I'm avoiding this issue with an argv check.

import { defineConfig } from "vite";
import checker from "vite-plugin-checker";

export default defineConfig(({ mode }) => ({
  plugins: [
    !process.argv.includes("optimize") &&
      checker({
        enableBuild: false,
        eslint: { lintCommand: 'eslint "./src/**/*.{ts,tsx}"' },
        stylelint: { lintCommand: 'stylelint "./src/**/*.{css,ts,tsx}"' },
        typescript: true,
      }),
  ],
}));