Skip to content

Commit 0742036

Browse files
committed
fix: config sourcemap support
1 parent 13cc840 commit 0742036

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/vite/src/node/config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2022,9 +2022,6 @@ async function bundleConfigFile(
20222022
},
20232023
// disable treeshake to include files that is not sideeffectful to `moduleIds`
20242024
treeshake: false,
2025-
// TODO: check if sourcemap works correctly
2026-
// the last slash is needed to make the path correct
2027-
// sourceRoot: path.dirname(fileName) + path.sep,
20282025
plugins: [
20292026
(() => {
20302027
const packageCache = new Map()
@@ -2130,6 +2127,9 @@ async function bundleConfigFile(
21302127
const result = await bundle.generate({
21312128
format: isESM ? 'esm' : 'cjs',
21322129
sourcemap: 'inline',
2130+
sourcemapPathTransform(relative) {
2131+
return path.resolve(fileName, relative)
2132+
},
21332133
})
21342134
await bundle.close()
21352135

0 commit comments

Comments
 (0)