Skip to content

magic-string error #4907

@ferparra

Description

@ferparra

Describe the bug

Getting the following error after pnpm exec vitest

Error: Cannot use replaced character 610 as slice start anchor.
 ❯ MagicString.slice node_modules/.pnpm/magic-string@0.30.5/node_modules/magic-string/dist/magic-string.es.mjs:924:10
 ❯ Object.transform node_modules/.pnpm/vite@5.0.11_@types+node@20.10.7/node_modules/vite/dist/node/chunks/dep-V3BH7oO1.js:64060:62
 ❯ loadAndTransform node_modules/.pnpm/vite@5.0.11_@types+node@20.10.7/node_modules/vite/dist/node/chunks/dep-V3BH7oO1.js:49741:29

Reproduction

Try using vi.hoisted in your code. I am not able to identify how to reproduce exactly because I'm unsure how to debug properly.

System Info

System:
    OS: macOS 14.2.1
    CPU: (8) arm64 Apple M2
    Memory: 59.13 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.5.0 - /opt/homebrew/bin/node
    npm: 10.2.4 - /opt/homebrew/bin/npm
    pnpm: 8.14.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Safari: 17.2.1
  npmPackages:
    @vitejs/plugin-react: ^4.2.1 => 4.2.1 
    vitest: ^1.1.3 => 1.1.3

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions