Skip to content

Cannot change SourceMaps path if esbuild is not used #8081

@croban

Description

@croban

Describe the bug

For the dev mode, I am using Babel for transpiling typescript and not esbuild which is turned off inside vite.config.
In that case all sourcemaps (..."sources":["app.ts"]) have only relative paths and not absolute path as they have when esbuild is used. It seems that default rollup sourcemap settings are used because exactly the same output I am getting using only rollup.
There is not way to create sourceMaps with absolute path or maybe I miss something.
e.g.

sourcemapPathTransform: (relativeSourcePath, sourcemapPath) => {
            // will replace relative paths with absolute paths
            return path.resolve(
              path.dirname(sourcemapPath),
              relativeSourcePath
            );
},

Reproduction

https://stackblitz.com/edit/vitejs-vite-kn5643?file=vite.config.js

System Info

npx envinfo --system --npmPackages '{vite,@vitejs/*}' --binaries --browsers

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions