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

vite-node stops working properly with minimatch since 0.31.2 #3609

Closed
6 tasks done
jameschenjav opened this issue Jun 18, 2023 · 3 comments
Closed
6 tasks done

vite-node stops working properly with minimatch since 0.31.2 #3609

jameschenjav opened this issue Jun 18, 2023 · 3 comments
Labels

Comments

@jameschenjav
Copy link

Describe the bug

It was working with vite-node ./my/script.ts, now it shows

> vite-node my/script

xxx/node_modules/.pnpm/minimatch@9.0.1/node_modules/minimatch/dist/mjs/index.js:126
        AST: class __vite_ssr_import_2__.AST extends orig.AST {
                                        ^

SyntaxError: Unexpected token '.'
    at new Script (node:vm:100:7)
    at createScript (node:vm:259:10)
    at Object.runInThisContext (node:vm:307:10)
    at ViteNodeRunner.directRequest (file://xxx/node_modules/.pnpm/vite-node@0.31.2_@types+node@18.16.18/node_modules/vite-node/dist/client.mjs:321:19)
    at ViteNodeRunner.cachedRequest (file://xxx/node_modules/.pnpm/vite-node@0.31.2_@types+node@18.16.18/node_modules/vite-node/dist/client.mjs:184:14)
    at ViteNodeRunner.dependencyRequest (file://xxx/node_modules/.pnpm/vite-node@0.31.2_@types+node@18.16.18/node_modules/vite-node/dist/client.mjs:219:12)
    at xxx/node_modules/.pnpm/glob@10.2.7/node_modules/glob/dist/mjs/index.js:1:31
    at ViteNodeRunner.directRequest (file://xxx/node_modules/.pnpm/vite-node@0.31.2_@types+node@18.16.18/node_modules/vite-node/dist/client.mjs:326:5)
    at ViteNodeRunner.cachedRequest (file://xxx/node_modules/.pnpm/vite-node@0.31.2_@types+node@18.16.18/node_modules/vite-node/dist/client.mjs:184:14)
    at ViteNodeRunner.dependencyRequest (file://xxx/node_modules/.pnpm/vite-node@0.31.2_@types+node@18.16.18/node_modules/vite-node/dist/client.mjs:219:12)

Node.js v18.16.0
 ELIFECYCLE  Command failed with exit code 1.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-kffe8s

In this example, run npm run rep will replicate the issue. As a counter example, npm run rep-tsx will execute without a problem.

Simply run with rimraf('*.tmp', { glob: true }) it will raise the exception.

System Info

> pnpx envinfo --system --npmPackages '{vitest,@vitest/*,vite,@vitejs/*}' --binaries --browsers
  System:
    OS: Linux 6.3 Fedora Linux 37 (Workstation Edition)
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
    Memory: 14.60 GB / 30.54 GB
    Container: Yes
    Shell: 3.6.1 - /usr/bin/fish
  Binaries:
    Node: 18.16.0 - ~/.volta/tools/image/node/18.16.0/bin/node
    Yarn: 1.22.19 - ~/.local/share/pnpm/yarn
    npm: 9.6.7 - ~/.volta/tools/image/npm/9.6.7/bin/npm
  Browsers:
    Chrome: 114.0.5735.133
    Firefox: 114.0
  npmPackages:
    vite: ^4.3.9 => 4.3.9

> pnpm -v
8.6.2

Used Package Manager

pnpm

Validations

@stackblitz
Copy link

stackblitz bot commented Jun 18, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sheremet-va
Copy link
Member

This is a bug in Vite SSR transform: vitejs/vite#13554

@jameschenjav
Copy link
Author

This issue can be closed now. Last week I updated vite to 4.4.2+, everything started working fine.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants