Skip to content

Commit 1f8ec3b

Browse files
Fix source map relative paths to sources
1 parent 2e17b40 commit 1f8ec3b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rollup.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join } from 'node:path';
1+
import { dirname, join, relative, resolve } from 'node:path';
22
import { DEFAULT_EXTENSIONS as extensions } from '@babel/core';
33
import { babel } from '@rollup/plugin-babel';
44
import commonjs from '@rollup/plugin-commonjs';
@@ -38,6 +38,12 @@ export default defineConfig(
3838
preserveModulesRoot: 'src',
3939
sourcemap: true,
4040
sourcemapExcludeSources: true,
41+
42+
// Fix source map relative paths to sources
43+
sourcemapPathTransform: (relativeSourcePath, sourcemapPath) => {
44+
const sourcePath = resolve(sourcemapPath, relativeSourcePath);
45+
return relative(dirname(sourcemapPath), sourcePath);
46+
},
4147
},
4248
],
4349
external: ['react/jsx-runtime', ...external],

0 commit comments

Comments
 (0)