Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix deprecation warning for Chunk.modulesIterable?

I am the maintainer of external-svg-sprite-loader and I noticed that when using it with webpack 5 I get the following warning:

[DEP_WEBPACK_CHUNK_MODULES_ITERABLE] DeprecationWarning: Chunk.modulesIterable: Use new ChunkGraph API

The build passes but I would like to able to fix this deprecation warning. However, I can't find any documentation about modulesIterable or the ChunkGraph API. Where should I look for it and what would be a potential solution for this issue?

like image 355
bensampaio Avatar asked Oct 19 '20 11:10

bensampaio


People also ask

How to iterate through all the modules in a chunk?

If you want to iterate through modules in chunk, you could do it like this: compilation.chunks.forEach (chunk => { compilation.chunkGraph.getChunkModules (chunk).forEach ( (module) => { // module is available here }) }); You could find other useful methods of this class in its source code.

What is the deprecation warning for installing a local Python package?

Bookmark this question. Show activity on this post. When I install a local python package with pip 21.1 ( pip install . )I get a deprecation warning: DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory.

What does NPM warn deprecated mean?

The npm WARN deprecated message means that the package installed on your project is not recommended for use. This may be due to issues found with the package or it’s no longer maintained. You may not even see these packages in your package.json file because they are dependencies of the packages that you are using.

How to fix the APT-key deprecation error on Ubuntu?

Fixing the apt-key deprecation error on Ubuntu can be done a number of ways. The recommended method from AskUbuntu is as follows. First, open a new Terminal window and then look inside your legacy apt-key file by running this command: Depending on your system you may see a couple of entries appear or a veritable avalanche.


Video Answer


1 Answers

If you want to iterate through modules in chunk, you could do it like this:

compilation.chunks.forEach(chunk => {
  compilation.chunkGraph.getChunkModules(chunk).forEach((module) => {
    // module is available here
  })
});

You could find other useful methods of this class in its source code. If you want to manipulate modules in chunk, probably it's better to use ModuleGraph class. For example:

compilation.chunks.forEach(chunk => {
  compilation.chunkGraph.getChunkModules(chunk).forEach((module) => {
    const exportInfo = compilation.chunkGraph.moduleGraph.getExportInfo(module);
  })
});
like image 64
Artem Nechunaev Avatar answered Nov 15 '22 11:11

Artem Nechunaev