-
Notifications
You must be signed in to change notification settings - Fork 28
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
Cannot find module error with webpack@5 #25
Comments
I don't think I understand the answer given in webpack/webpack#11971. What's the symlink that's causing this behavior? |
I could use your help creating a PR to fix this @MikeDevice. |
I don't fully understand as well, but I figured out that // webpack.config.js
module.exports = {
resolve: { symlinks: false },
plugins: [new LicenseCheckerWebpackPlugin()]
}; But of course it's not a solution at all. I think all we need is to check whether dependency has license-checker-webpack-plugin/src/licenseUtils.js Lines 45 to 46 in d4a5d47
What do you think? |
Yup, that's probably what's causing the issue. Do you want to try and submit a PR to fix this? |
Yes. I'll try. |
Fixed by changing filter to |
@OpportunityLiu, Yes, we are, but I'm not sure, that this regex can cover all cases. |
Maybe it's good to do something like that: Plugin Patterns |
I think the problem occurs whenever using a package in the form of As soon as I add this line to a .jsx file:
I get this error:
It looks like We're using Webpack 5 and Yarn Berry with the PnP (Plug and Play) feature enabled. Hope this helps 🙂 Let me know you if I can provide any additional information. |
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.
Another workaround is using the fixed
|
#37 doesn't fix this problem for me. license-checker has been working fine for a while, but in the last day, it just stopped working. I haven't figured out which package related to webpack changed yet, but I suspect something in webpack. When I make a debug plugin for webpack to look deeper, I see compilation.fileDependencies contains these non-existent files:
Those paths cause license-checker to throw exceptions. But, these paths do exist: (note the @svgr/package.json doesn't exist.)
If filter would accept a function OR a RegExp, a filter function could check for file existence or make other attempts at coercing the paths into ones that exist in the file system before the require() is called... but that may just hide the root cause problem of dealing with what looks like invalid paths showing up from webpack's fileDependencies. |
Sometimes this plugin can break a build with an error when
webpack@5
is used:It's easy to reproduce this issue. Just add to the project
@babel/runtime
dependency and try to make a build. The build will be broken with the follow error:Here is an example repo: webpack-file-dependencies-issue/tree/license-checker-webpack-plugin-example.
Initial issue: webpack/webpack#11971
The text was updated successfully, but these errors were encountered: