Skip to content

escape-sql-string stopped working in vite 8 #546

@peterbe

Description

@peterbe

Describe the bug

I have a SPA built with Vite 7 that I tried upgrading to Vite 8.
See adjacent blog post about it here: https://www.peterbe.com/plog/vite-8-is-5x-faster

However, when starting the dev server, and viewing a component that depends on...

import escapeString from "escape-sql-string"

it throws this error:

TypeError: escapeString is not a function

If you console.log it with

import escapeString from "escape-sql-string"
console.log(escapeString)

its output is:

{__esModule: true, default: ƒ}

Reproduction

https://github.com/peterbe/vite8-esape

Steps to reproduce

See https://github.com/peterbe/vite8-esape
clone it and npm install && npm run dev and then open http://localhost:5173/

System Info

System:
    OS: macOS 15.7.1
    CPU: (12) arm64 Apple M4 Pro
    Memory: 359.92 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.19.0 - /Users/peterbengtsson/.local/state/fnm_multishells/67297_1764989798715/bin/node
    npm: 10.9.3 - /Users/peterbengtsson/.local/state/fnm_multishells/67297_1764989798715/bin/npm
    pnpm: 8.15.9 - /Users/peterbengtsson/Library/pnpm/pnpm
    bun: 1.3.3 - /Users/peterbengtsson/.bun/bin/bun
  Browsers:
    Chrome: 142.0.7444.176
    Firefox: 144.0.2
    Safari: 18.6
  npmPackages:
    @vitejs/plugin-react: ^5.1.1 => 5.1.1
    rolldown-vite:  7.2.5

Used Package Manager

npm

Logs

My real project where I encountered this is I use Bun. But I used npm create vite@latest to create an absolute minimal thing that encounters the bug.

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions