Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/improve module dependency warning check #1

Merged
merged 3 commits into from Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion index.js
Expand Up @@ -23,6 +23,13 @@ module.exports = class IgnoreNotFoundExportPlugin {
});
}

isModuleDependencyWarning(warning) {
return (
warning instanceof ModuleDependencyWarning ||
warning.constructor.name === 'ModuleDependencyWarning'
);
}

isResourcePathAllowed(resourcePath) {
return this.include.some((regExp) => regExp.test(resourcePath));
}
Expand All @@ -33,7 +40,7 @@ module.exports = class IgnoreNotFoundExportPlugin {
stats.compilation.warnings = stats.compilation.warnings.filter(
(warning) =>
!(
warning instanceof ModuleDependencyWarning &&
this.isModuleDependencyWarning(warning) &&
EXPORT_NOT_FOUND_REG_EXP.test(warning.message) &&
this.isResourcePathAllowed(warning.module.resource)
),
Expand Down
102 changes: 30 additions & 72 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion readme.md
Expand Up @@ -5,7 +5,13 @@
## Install

```
$ npm install --save-dev ignore-not-found-export-webpack-plugin
npm install --save-dev ignore-not-found-export-webpack-plugin
```

or

```
yard add --dev ignore-not-found-export-webpack-plugin
```

## Usage
Expand Down