Skip to content

Commit a32c510

Browse files
committed
feat!: remove cwd from filenames by default
1 parent 239f0bc commit a32c510

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ Directory for the output. Defaults to `.vite-source-map-visualizer`.
6565

6666
### `formatName`
6767

68-
Format name of the files. For example to remove `process.cwd()`:
68+
Format name of the files:
6969

7070
```ts
7171
export default defineConfig({
7272
plugins: [
7373
sourcemapVisualizer({
74-
formatName: (filename) => filename.replace(process.cwd(), "/<root>"),
74+
formatName: (filename) => filename.replace("src/", "/"),
7575
}),
7676
],
7777
});

src/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function generateHTML(results: Result[]) {
160160
}
161161

162162
function defaultFormatName(filename: string) {
163-
return decodeURI(filename);
163+
return filename.replace(process.cwd(), "");
164164
}
165165

166166
function escapeHTML(str: string) {

0 commit comments

Comments
 (0)