Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect paths within sourcemaps #483

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading