@@ -5,33 +5,21 @@ import * as docGen from "react-docgen-typescript";
55
66// eslint-disable-next-line
77// @ts -ignore: What's the right way to refer to this one?
8- import ModuleDependency from "webpack/lib/dependencies/ModuleDependency .js" ;
8+ import Module from "webpack/lib/Module .js" ;
99
1010// eslint-disable-next-line
1111// @ts -ignore: What's the right way to refer to this one?
1212import makeSerializable from "webpack/lib/util/makeSerializable.js" ;
1313
1414// eslint-disable-next-line
1515// @ts -ignore TODO: Figure out where to find a typed version
16- import Dependency from "webpack/lib/Dependency .js" ;
16+ import NullDependency from "webpack/lib/dependencies/NullDependency .js" ;
1717
1818import { generateDocgenCodeBlock } from "./generateDocgenCodeBlock" ;
1919import { LoaderOptions } from "./types" ;
2020
21- class DocGenDependency extends ModuleDependency {
22- public static Template : ModuleDependency . Template ;
23-
24- getReferencedExports ( ) : [ ] {
25- return Dependency . NO_EXPORTS_REFERENCED ;
26- }
27-
28- get type ( ) : string {
29- return "docgen" ;
30- }
31-
32- get category ( ) : string {
33- return "docs" ;
34- }
21+ class DocGenDependency extends NullDependency {
22+ public static Template : NullDependency . Template ;
3523
3624 // TODO: Note if you want that modules correctly invalidate and cache you need to add updateHash to your Dependency and hash the type info (because that might change depending on outside factors (other modules)
3725}
@@ -43,7 +31,7 @@ type Options = {
4331 docgenOptions : LoaderOptions ;
4432} ;
4533
46- class DocGenTemplate extends ModuleDependency . Template {
34+ class DocGenTemplate extends NullDependency . Template {
4735 private options : Options ;
4836
4937 constructor ( options : Options ) {
@@ -52,8 +40,12 @@ class DocGenTemplate extends ModuleDependency.Template {
5240 this . options = options ;
5341 }
5442
55- apply ( dependency : Dependency , source : ReplaceSource ) : void {
56- const { userRequest } = dependency ;
43+ apply (
44+ dependency : NullDependency ,
45+ source : ReplaceSource ,
46+ { module } : { module : Module }
47+ ) : void {
48+ const { userRequest } = module ;
5749
5850 // Since parsing fails with a path including !, remove it.
5951 // The problem is that webpack injects that and there doesn't
0 commit comments