Definitelytyped: [@types/terser-webpack-plugin] Unterstützung für Webpack 5

Erstellt am 15. Okt. 2020  ·  4Kommentare  ·  Quelle: DefinitelyTyped/DefinitelyTyped

@types/terser-webpack-plugin unterstützt keine Webpack 5-Typen, die jetzt von Webpack selbst generiert werden.

node_modules/@types/terser-webpack-plugin/index.d.ts:7:10 - error TS2305: Module '"../../webpack/types"' has no exported member 'Plugin'.

7 import { Plugin } from 'webpack';
           ~~~~~~
  • [x] Ich habe versucht, das Paket @types/terser-webpack-plugin und hatte Probleme.
  • [x] Ich habe versucht, die neueste stabile Version von tsc zu verwenden. https://www.npmjs.com/package/typescript
  • [x] [Erwähnen](https://github.com/blog/821-mention-somebody-they-re-notified) die Autoren (siehe Definitions by: in index.d.ts ), damit sie es können Antworten.

    • Autoren: @Danscho , @peterblazejewicz

Hilfreichster Kommentar

Ich habe eine weitere Fehlermeldung in der Webpack-Konfigurationsdatei, wenn ich terser-webpack-plugin 5.0.0 mit Webpack 5 verwende:

Type 'TerserPlugin' is not assignable to type '"..." | WebpackPluginInstance | ((this: Compiler, compiler: Compiler) => void)'.
  Type 'TerserPlugin' is not assignable to type '(this: Compiler, compiler: Compiler) => void'.
    Type 'TerserPlugin' provides no match for the signature '(this: Compiler, compiler: Compiler): void'.ts(2322)

Hat noch jemand dieses Problem?

Alle 4 Kommentare

@peterblazejewicz hat bereits einen Pull-Request erstellt.
Siehe: #48794.
Dies sollte Ihr Problem lösen.

Ich habe eine weitere Fehlermeldung in der Webpack-Konfigurationsdatei, wenn ich terser-webpack-plugin 5.0.0 mit Webpack 5 verwende:

Type 'TerserPlugin' is not assignable to type '"..." | WebpackPluginInstance | ((this: Compiler, compiler: Compiler) => void)'.
  Type 'TerserPlugin' is not assignable to type '(this: Compiler, compiler: Compiler) => void'.
    Type 'TerserPlugin' provides no match for the signature '(this: Compiler, compiler: Compiler): void'.ts(2322)

Hat noch jemand dieses Problem?

Soweit ich das beurteilen kann, ist das Problem, dass die neueste Version von @types/terser-webpack-plugin auch nach #48794 immer noch @types/webpack@* als Abhängigkeit angibt, die sich in [email protected] auflöst. Es scheint, dass diese Abhängigkeit irgendwie implizit von @DefinitelyTyped hinzugefügt wird, da ich sie in package.json nicht finden kann. Müssen wir vielleicht webpack@5 als Abhängigkeit hinzufügen, um dies zu verhindern?

webpack@5 exportiert auch Plugin nicht mehr, sondern zB WebpackPluginInstance .

@buschtoens
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/48857
Es gab das gleiche Problem mit Webpack 5.

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen