Skip to content
This repository was archived by the owner on Nov 20, 2023. It is now read-only.
This repository was archived by the owner on Nov 20, 2023. It is now read-only.

[types] Use of webpack-5-only type breaks builds #321

@lobsterkatie

Description

@lobsterkatie

Two years ago, we modified the errorHandler option to take a third argument, of the type Compilation. Though the contents of the type exists in similar forms in webpack 4 and 5, in webpack 4 it's exported as compilation.Compilation, where as in webpack 5, it's exported at the top-level.

This didn't matter much until about a month ago, when #308 updated the overall options type to reflect the addition of the third argument for errorHandler. That change was released two days ago, in v 1.17.2. Because that PR used Compilation in its webpack 5/top-level form, anyone using this plugin together with webpack 4 and TS will receive the following error when they import the plugin (assuming they have skipLibCheck set to false in their TS config):

image

Steps to Reproduce

  1. Create a TS project with webpack@4.x, @types/webpack@4.x, and @sentry/webpack-plugin@1.17.2 as dependencies
  2. Import the plugin (import { default as SentryWebpackPlugin } from "@sentry/webpack-plugin";)
  3. Set skipLibCheck to false in the TS config
  4. Run tsc

Expected Result

No error

Actual Result

The error above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions