Skip to content

fix: add Plugin to built-in d.ts from @types/webpack#11698

Closed
pastak wants to merge 1 commit intowebpack:mainfrom
pastak:add-plugin-type
Closed

fix: add Plugin to built-in d.ts from @types/webpack#11698
pastak wants to merge 1 commit intowebpack:mainfrom
pastak:add-plugin-type

Conversation

@pastak
Copy link
Copy Markdown

@pastak pastak commented Oct 15, 2020

ref: #11630

Many typings of packages use Plugin now. If they have to change it to use WebpackPluginInstance they treat it as a breaking change. This is a large impact on packages even if webpack@5 is a major update version and a breaking change (ex: getsentry/sentry-webpack-plugin#233 ) . Could you avoid this situation?

What kind of change does this PR introduce?

bugfix

Did you add tests for your changes?

Does this PR introduce a breaking change?

no

What needs to be documented once your changes are merged?

@webpack-bot
Copy link
Copy Markdown
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

@webpack-bot
Copy link
Copy Markdown
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

Comment thread lib/index.js
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} Plugin */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebpackPluginInstance and Plugin are not the same.
WebpackPluginInstance is an interface, Plugin in @types/webpack is an abstract class.
One can't use an interface with class extends WebpackPluginInstance.

You can create a new Plugin type as abstract class to create compatibility.

Copy link
Copy Markdown
Author

@pastak pastak Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. I'll do it 👍

Copy link
Copy Markdown

@dudiharush dudiharush Oct 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi sokra and pastak,
I also encountered this problem. Are you going to fix it soon?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I am still facing this issue -- any way there is going to be a fix?

@vankop
Copy link
Copy Markdown
Member

vankop commented Sep 15, 2021

Thanks for your contribution. I am closing PR because it is too stale..

@vankop vankop closed this Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants