-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Copy link
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
After upgrading Prettier, import.meta.resolve() calls in vite.config.ts get reformatted across multiple lines, causing the build to fail:
// Before (works)
import.meta.resolve('@some/package')
// After Prettier (broken)
import.meta
.resolve('@some/package')getting this error:
ReferenceError: __vite_injected_original_import_meta_resolve is note the expression when split across lines, so it fails to inject the resolver helper.
This appears related to #20326 which was fixed in #20962, but that fix doesn't handle the case where formatters break the expression across lines.
Reproduction
https://stackblitz.com/edit/vitejs-vite-1d7x8izq?file=vite.config.ts
Steps to reproduce
No response
System Info
System:
OS: macOS 26.2
CPU: (16) arm64 Apple M4 Max
Memory: 4.52 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.11.0 - ~/.nvm/versions/node/v24.11.0/bin/node
Yarn: 4.12.0 - ~/.nvm/versions/node/v24.11.0/bin/yarn
npm: 11.6.1 - ~/.nvm/versions/node/v24.11.0/bin/npm
bun: 1.3.4 - /opt/homebrew/bin/bun
Browsers:
Chrome: 143.0.7499.110
Firefox: 146.0
Safari: 26.2
npmPackages:
vite: ^7.2.6 => 7.2.6Used Package Manager
yarn
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)