Skip to content
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

Vite 6 config's source map file reference is off #18832

Closed
7 tasks done
hi-ogawa opened this issue Nov 29, 2024 · 0 comments · Fixed by #18833
Closed
7 tasks done

Vite 6 config's source map file reference is off #18832

hi-ogawa opened this issue Nov 29, 2024 · 0 comments · Fixed by #18833
Labels
p2-edge-case Bug, but has workaround or limited in scope (priority)

Comments

@hi-ogawa
Copy link
Collaborator

Describe the bug

I would assume users haven't done this often, but I just realized it's possible to enable node's source map for Vite's config import. When it's enabled, file reference is off since we moved bundle file to node_modules/.vite-temp #18509 but source map sources entries are still relative from cwd.

On Vite 5

$ NODE_OPTIONS=--enable-source-maps npx vite
Trace: test
    at f2 (/my/cwd/vite.config.ts:10:11)
    at f1 (/my/cwd/vite.config.ts:6:3)
    at <anonymous> (/my/cwd/vite.config.ts:13:1)

On Vite 6

$ NODE_OPTIONS=--enable-source-maps npx vite
Trace: test
    at f2 (/my/cwd/node_modules/.vite-temp/vite.config.ts:10:11) 
    at f1 (/my/cwd/node_modules/.vite-temp/vite.config.ts:6:3)
    at <anonymous> (/my/cwd/node_modules/.vite-temp/vite.config.ts:13:1)

Reproduction

https://github.com/hi-ogawa/reproductions/tree/main/vite-config-bundle-source-map

Steps to reproduce

Cannot reproduce on stackblitz but you can test locally by downloading https://stackblitz.com/github/hi-ogawa/reproductions/tree/main/vite-config-bundle-source-map?file=README.md

System Info

System:
    OS: Linux 6.11 Arch Linux
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-12650H
    Memory: 15.93 GB / 31.05 GB
    Container: Yes
    Shell: 5.2.37 - /usr/bin/bash
  Binaries:
    Node: 20.18.1 - ~/.volta/tools/image/node/20.18.1/bin/node
    npm: 10.8.2 - ~/.volta/tools/image/node/20.18.1/bin/npm
    pnpm: 9.14.2 - ~/.volta/bin/pnpm
    bun: 1.1.29 - ~/.volta/bin/bun
  Browsers:
    Chromium: 131.0.6778.85
  npmPackages:
    vite: ^6 => 6.0.1

Used Package Manager

pnpm

Logs

No response

Validations

@sapphi-red sapphi-red added the p2-edge-case Bug, but has workaround or limited in scope (priority) label Nov 29, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p2-edge-case Bug, but has workaround or limited in scope (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants