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

Filter scoped modules correctly #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

bz2
Copy link
Contributor

@bz2 bz2 commented Apr 4, 2021

Fixes #25

A valid node module name is either \w+ or @\w+/\w+ never @\w+.

This is enough of a hairy internal implementation detail that filter should probably not be exposed even as an (undocumented) option. But leaving alone for now as changing the pattern has been a useful workaround.

There are some other implications from the webpack 5 changes to fileDependencies and the current code behaviours but those will need a bit more discussion to address I think.

Fixes microsoft#25

A valid node module name is either `\w+` or `@\w+/\w+` never `@\w+`.

This is enough of a hairy internal implementation detail that filter
should probably not be exposed even as an (undocumented) option. But
leaving alone for now as changing the pattern has been a useful
workaround.
@Eli-Black-Work
Copy link

Thank you so much for this!! 🙂

FYI, I think the tests will break when using Yarn PnP, since then there won't be a node_modules folder.

@felixfontein
Copy link

This fixes the problems described in #45 and #43 for me. If anyone else cares, this PR can also be used as a workaround by adding the filter definition from it into your LicenseCheckerWebpackPlugin options, like this:

    new LicenseCheckerWebpackPlugin({
      allow: "(Apache-2.0 OR BSD-2-Clause OR BSD-3-Clause OR MIT OR 0BSD)",
      filter: /(^.*[/\\]node_modules[/\\]((?:@[^/\\]+[/\\])?(?:[^@/\\][^/\\]*)))/,
      ...

Would still be better if this could be merged and released :)

jojomatik added a commit to jojomatik/blockcluster that referenced this pull request Feb 20, 2022
…ugin`

Filter scoped modules correctly in `license-checker-webpack-plugin` to fix an error while building.

See also: microsoft/license-checker-webpack-plugin#37
@domis4
Copy link

domis4 commented May 26, 2022

anychance microsoft will actually review this?

@bz2
Copy link
Contributor Author

bz2 commented May 27, 2022

Part of the issue may the that the maintainer now works at twitter not ms. Maybe @unindented could suggest a former colleague I could bug about taking over package?

1 similar comment
@bz2
Copy link
Contributor Author

bz2 commented May 27, 2022

Part of the issue may the that the maintainer now works at twitter not ms. Maybe @unindented could suggest a former colleague I could bug about taking over package?

@stritti
Copy link

stritti commented Nov 10, 2023

Have same issue with vuejs:

 ERROR  HookWebpackError: Cannot find module 'node_modules\@vue/package.json'
        Require stack:
        - node_modules\license-checker-webpack-plugin\src\licenseUtils.js
        - node_modules\license-checker-webpack-plugin\src\index.js
        - vue.config.js
        - package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot find module error with webpack@5
5 participants