Skip to content

sourcemapPathTransform ​

  • Type: (relativeSourcePath, sourcemapPath) => string
  • Optional

A transformation to apply to each path in a sourcemap.

Parameters ​

relativeSourcePath ​

string

The relative path from the generated .map file to the corresponding source file.

sourcemapPath ​

string

The fully resolved path of the generated sourcemap file.

Returns ​

string

Example ​

js
export default defineConfig({
  output: {
    sourcemap: true,
    sourcemapPathTransform: (source, sourcemapPath) => {
      // Remove 'src/' prefix from all source paths
      return source.replace(/^src//, '');
    },
  },
});

Was this page helpful?