question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to deal with variables in class DependenciesBlock in Webpack 5

See original GitHub issue

Hi,

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:

  1. toConstantDependency
  2. addParsedVariableToModule

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:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
sokracommented, May 2, 2020

Depending on the use case you may be able to use one of the core dependency classes for that.

0reactions
alexander-akaitcommented, Aug 3, 2020

Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Guide to Managing Webpack Dependencies - Toptal
A Guide to Managing Webpack Dependencies · Configuring Aliases and Relative Paths · Code Splitting · Extracting Styles Into Separate Bundles · Handling...
Read more >
Dependency Management - webpack
keys is a function that returns an array of all possible requests that the context module can handle. This can be useful if...
Read more >
Module Variables - webpack
This section covers all variables available in code compiled with webpack. Modules will have access to certain data from the compilation process through ......
Read more >
Externals - webpack
The externals configuration option provides a way of excluding dependencies from the output bundles. Instead, the created bundle relies on that dependency ......
Read more >
Entry Points - webpack
This is useful when you would like to inject multiple dependent files together and graph their dependencies into one "chunk". webpack.config.js module.exports = ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found