Skip to content

fix(repack): respect output.devtoolModuleFilenameTemplate in SourceMapPlugin - #1532

Open
JaydeepAgravat wants to merge 1 commit into
callstack:mainfrom
JaydeepAgravat:fix/sourcemap-devtool-module-filename-template
Open

JaydeepAgravat wants to merge 1 commit into
callstack:mainfrom
JaydeepAgravat:fix/sourcemap-devtool-module-filename-template

Conversation

@JaydeepAgravat

Copy link
Copy Markdown

Summary

Without the dev server (for example with the bundle command), SourceMapPlugin always writes absolute paths from the build machine to sources and ignores output.devtoolModuleFilenameTemplate. The line that read the option was commented out in #1172, when the plugin got its own module filename handlers for dev and production.

As discussed in #1518, this keeps the current default and only uses output.devtoolModuleFilenameTemplate when it's set and the dev server isn't running. Neither Rspack nor webpack sets a default for this option, and Re.Pack's config defaults don't set it either, so existing builds produce the same sources as before. The dev server case is unchanged.

I also added a short SourceMapPlugin section to the internal plugins docs page with an example.

Test plan

  • New test packages/repack/src/plugins/__tests__/SourceMapPlugin.test.ts builds a small project with Rspack and no dev server, and checks sources:
    • without the option: absolute paths, as before
    • with devtoolModuleFilenameTemplate: 'app://[resource-path]': app://./index.js, app://./src/answer.js and no absolute paths
    • Without the fix, the second case fails; with it, both pass.
  • Ran the same test with webpack locally (not committed): both cases pass.
  • pnpm --filter @callstack/repack test: 44 suites, 388 tests passed.
  • pnpm --filter @callstack/repack typecheck and pnpm lint pass.
  • Added a patch changeset for @callstack/repack.

Fixes #1518

@vercel

vercel Bot commented Nov 21, 2026

Copy link
Copy Markdown

@JaydeepAgravat is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 645ae60

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Patch
@callstack/repack-plugin-expo-modules Patch
@callstack/repack-plugin-nativewind Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack-dev-server Patch
@callstack/repack-init Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remove absolute file paths embedded in sourcemaps generated by SourceMapPlugin

1 participant