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
965 stars 84 forks source link

latest `vite-plugin-checker@0.6.1` doesn't work well with `meow@10` (from latest `stylelint` v15.10.1) #260

Open tryforceful opened 1 year ago

tryforceful commented 1 year ago

Describe the bug

The latest Stylelint v15.10.1 now uses meow@^10, updating to that version to remove a recently announced semver vulnerability from the dependency tree.

However, using meow@10 with the latest vite-plugin-checker generates errors for me when trying to build with Vite:

TypeError [Error]: The `importMeta` option is required. Its value must be `import.meta`.
    at meow (/poc--20230714-meow-vite-plugin-checker/node_modules/.pnpm/meow@10.1.5/node_modules/meow/index.js:111:9)
    at translateOptions (/poc--20230714-meow-vite-plugin-checker/node_modules/.pnpm/vite-plugin-checker@0.6.1_stylelint@15.10.1_typescript@5.0.2_vite@4.4.0_vue-tsc@1.8.3/node_modules/vite-plugin-checker/dist/esm/checkers/stylelint/options.js:5:18)
    at Object.configureServer (/poc--20230714-meow-vite-plugin-checker/node_modules/.pnpm/vite-plugin-checker@0.6.1_stylelint@15.10.1_typescript@5.0.2_vite@4.4.0_vue-tsc@1.8.3/node_modules/vite-plugin-checker/dist/esm/checkers/stylelint/main.js:34:39)
    at MessagePort.<anonymous> (/poc--20230714-meow-vite-plugin-checker/node_modules/.pnpm/vite-plugin-checker@0.6.1_stylelint@15.10.1_typescript@5.0.2_vite@4.4.0_vue-tsc@1.8.3/node_modules/vite-plugin-checker/dist/esm/worker.js:57:26)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:323:10)
    at [kOnMessage] (node:internal/worker:334:37)
    at MessagePort.<anonymous> (node:internal/worker:229:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

It seems likely to me that the reason is because the breaking changes to meow@10 are that the package is fully ESM now: https://github.com/sindresorhus/meow/releases/tag/v10.0.0

Using meow@9 doesn't generate this error for me.

Reproduction

See minimal repro at this repo: https://github.com/tryforceful/poc--20230714-meow-vite-plugin-checker

Try to build that package with pnpm i; pnpm dev and it will generate the above error.

If you comment out these lines in the vite.config.js which enable vite-plugin-checker:

    // Comment me out to disable the error
    checker({
      stylelint: {
        lintCommand: 'stylelint ./src/style.css',
      },
    })

the error also goes away, showing that vite-plugin-checker is having difficulty using the implicit dependency meow@10 from stylelint.

Note that running stylelint alone in this repo also works fine.

Expected behavior

I expect no error when running pnpm dev while using the latest vite-plugin-checker and stylelint (v15.10.1)

System Info

System:
    OS: macOS 12.6.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 245.20 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.2.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.6.6 - /usr/local/bin/npm
    pnpm: 8.6.7 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 114.0.5735.198
    Safari: 15.6.1
  npmPackages:
    vite-plugin-checker: 0.6.1 => 0.6.1

Additional context

See #255 where upgrading meow is also being requested

Validations

tryforceful commented 1 year ago

This has been slowly getting πŸ‘πŸΌs and it's been a month, any update?

tryforceful commented 11 months ago

😬😬😬

Reloaded2 commented 10 months ago

Any updates here? Thanks

jeron-diovis commented 10 months ago

For those who's waiting for this fix, for time being you can bypass this with explicit deps overriding.

With yarn:

"resolutions": {
  "meow": "^9.0.0"
}

With npm it's overrides.

strawberry-choco commented 8 months ago

Any updates? Stylelint 16 is using meow ^13.0.0. Pinning meow to version 9 is not a permanent solution.

Miofly commented 3 months ago

same issue,how to resolve

coolxiaohao commented 3 months ago

same issue,how to resolve?