Skip to content

Commit 84c41a7

Browse files
committed
Fix deprecation warnings by using chunk.forEachModule
1 parent 94a6ac5 commit 84c41a7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ In both examples Webpack would output:
4141

4242
## Installation
4343
```bash
44+
// For Webpack v3.x
4445
npm install --save-dev webpack-omit-js-for-css-plugin
46+
47+
// For Webpack v2.x
48+
npm install --save-dev webpack-omit-js-for-css-plugin@1.0.2
4549
```
4650
## Usage
4751

src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ OmitJSforCSSPlugin.prototype.findOmissibleFiles = function(compilation) {
5454
});
5555

5656
// Each entry point will have its own dependencies, based on the files inner deps or the array deps in entry
57-
chunk.modules.forEach(module => {
57+
chunk.forEachModule(module => {
5858
if (!Array.isArray(module.fileDependencies)) {
5959
return;
6060
}
6161
module.fileDependencies.forEach(filepath => {
62-
if (!resourceOrigin[filepath] && !/(\bnode_modules\b)/.test(filepath) && /\.(css|js)/g.test(filepath)) {
62+
if (!resourceOrigin[filepath] && !/(\bnode_modules\b)/.test(filepath) && /\.(css|js)$/g.test(filepath)) {
6363
/\.(css)$/i.test(filepath) ? assetTypeCount.css++ : assetTypeCount.internal++;
6464
}
6565
});

0 commit comments

Comments
 (0)