Skip to content

Commit

Permalink
fix incorrect paths within sourcemaps
Browse files Browse the repository at this point in the history
  • Loading branch information
dcastil committed Oct 14, 2024
1 parent a6d0954 commit 004fbec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// @ts-check

import path from 'node:path'

import { getBabelOutputPlugin } from '@rollup/plugin-babel'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
Expand Down Expand Up @@ -52,7 +54,7 @@ export default defineConfig([
// We don't want to emit declaration files more than once
declaration: false,
declarationMap: false,
outDir: 'dist/es5/types',
outDir: path.dirname(pkg.exports['./es5'].import),
},
}),
],
Expand Down Expand Up @@ -92,6 +94,11 @@ function getOutputConfig({ file, format, targets }) {
sourcemap: true,
freeze: false,
generatedCode: 'es2015',
sourcemapPathTransform(relativeSourcePath) {
// This is necessary because of the tsconfig.compilerOptions.outDir option resulting in a path one level deeper than the output directory.
// But we also don't want to sync those output paths because that would make the setup for rollup-plugin-delete more complicated.
return relativeSourcePath.replace('../', '')
},
plugins: [
getBabelOutputPlugin({
presets: [
Expand Down

0 comments on commit 004fbec

Please sign in to comment.