Skip to content

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

@thristhart

Description

@thristhart

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions