Skip to content

Only show error backtrace when VITE_BACKTRACE=1 #20055

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

Open
4 tasks done
typed-sigterm opened this issue May 17, 2025 · 0 comments · May be fixed by #20104
Open
4 tasks done

Only show error backtrace when VITE_BACKTRACE=1 #20055

typed-sigterm opened this issue May 17, 2025 · 0 comments · May be fixed by #20104

Comments

@typed-sigterm
Copy link

Description

Just moved a file... the terminal at the bottom of VS Code suddenly exploded with a long error:

10:31:57 [vite] Internal server error: Failed to resolve import "../utility" from "src/providers/auth.ts". Does the file exist?
  Plugin: vite:import-analysis
  File: .../src/providers/auth.ts:2:21
  1  |  import { supa } from "../utility";
     |                        ^
  2  |  const authProvider = {
  3  |    async login({ email, password, providerName }) {
      at TransformPluginContext._formatLog (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:42499:41)
      at TransformPluginContext.error (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:42496:16)
      at normalizeUrl (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:40475:23)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      at async file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:40594:37
      at async Promise.all (index 0)
      at async TransformPluginContext.transform (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:40521:7)
      at async EnvironmentPluginContainer.transform (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:42294:18)
      at async loadAndTransform (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:35735:27)   
      at async viteTransformMiddleware (file:///.../node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:37250:24)

It's filled with the most secondary information, while the most important information needs to be unfolded to be seen.

Suggested solution

Like rust:

thread 'main' panicked at src/main.rs:2:5:
some error message...
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
10:31:57 [vite] Internal server error: Failed to resolve import "../utility" from "src/providers/auth.ts". Does the file exist?
  Note: run with `VITE_BACKTRACE=1` environment variable to display a backtrace

Alternative

No response

Additional context

No response

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants