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

Webpack plugin doesn't add banners to files that have query parameters #596

Closed
Thristhart opened this issue Aug 27, 2024 · 1 comment · Fixed by #597
Closed

Webpack plugin doesn't add banners to files that have query parameters #596

Thristhart opened this issue Aug 27, 2024 · 1 comment · Fixed by #597

Comments

@Thristhart
Copy link
Contributor

Environment

@sentry/webpack-plugin: 2.22.2
webpack: 5.92.1

Steps to Reproduce

Use a webpack config that creates files with query parameters. The common case is hashes, e.g.:

{
  // ... snip
  output: {
    filename: "[name].js?contenthash=[contenthash]",
  },
  plugins: [ sentryWebpackPlugin() ]
}

Expected Result

The debugid and metadata injection banner plugins would add banners to these files.

Actual Result

The files are emitted without the banner plugins adding banners.

This is because of these include regexes:

include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,

A quick fix would be to expand the regex to allow query params:

/\.(js|ts|jsx|tsx|mjs|cjs)(\?.*?)?$/

Alternatively, if I could specify my own regex for files that get banners, that might be a more flexible solution.

Happy to put up a PR with the query-allowing regex if that's the direction you prefer.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Aug 27, 2024
@lforst
Copy link
Member

lforst commented Aug 28, 2024

Wondering if there are any edge-cases with that regex. Happy to take a look at the PR if you open one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants