How to deal with variables in class DependenciesBlock in Webpack 5
See original GitHub issueHi,
I’m trying to learn Webpack internals in order to upgrade worker-plugin to Webpack 5 support. Actually it leverages on Webpack v4 ParserHelpers methods:
toConstantDependencyaddParsedVariableToModule
The first is present also in Webpack v5 JavascriptParserHelpers but the second is not. I followed the source code and stumbled into the DependenciesBlock class
The DependenciesBlock class features a this.variables = [] property in Webpack v4 which is missing in the constructor method in Webpack v5.
The same applies to the addVariable method which is present in DependenciesBlock for Webpack v4 but not for Webpack v5. This specific method is the one that is called by the addParsedVariableToModule in Webpack v4 ParserHelpers.
I would like to know if there’s a beaten path to follow for this particular update case from Webpack v4 to Webpack v5?
Thanks 💯 for the awesome lib!!!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)

Top Related StackOverflow Question
Depending on the use case you may be able to use one of the core dependency classes for that.
Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!