Skip to content

"node:sqlite" Not loading correctly #7177

@drazisil

Description

@drazisil

Describe the bug

Attempting to interact with "node:sqlite" in any way triggers an error along the lines of

Error: Failed to load url sqlite (resolved id: sqlite). Does the file exist?

 - /node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:51969:17

for my reproduction example, all I needed to do was add import { DatabaseSync } from 'node:sqlite'; to the basic.test.ts file. The StackBlitz list is node 18, because I don't know how to change it, but this bug happens with both Node.js 22 and 23.

I believe it is related to vitest appearing to drop the "node:" part of the import. Please let me know how I can further help.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-yb6tuuwk?file=test%2Fbasic.test.ts,package.json&initialPath=__vitest__/

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 7.86 GB / 15.53 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 23.5.0 - ~/.nvm/versions/node/v23.5.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v23.5.0/bin/npm
    pnpm: 9.15.2 - ~/.local/share/pnpm/pnpm
    bun: 1.1.38 - ~/.bun/bin/bun
  npmPackages:
    @vitest/coverage-v8: ^2.1.8 => 2.1.8 
    vitest: ^2.1.8 => 2.1.8

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions