Closed tobiasweibel closed 6 years ago
I've already created some working code. I'll publish that as soon as I get access to my company's fork.
The change sounds reasonable. I will try it out.
If your node_modules directory is symlinked into your source directory, couldn't you use a relative path in the modulesDirectories
option instead? It might help if you can show me the layout of your project (with respect to node_modules directories) as well.
By the way, I removed this path joining logic in the next release (currently in alpha). Could you test that out for me? It should be a lot more reliable. See issue #43 for the instructions.
In the next release, I replaced the module prefix logic with a scan for a package.json file.
Example: If webpack reports a file such as /path/to/node_modules/a/b/c/d.js (which belongs to module a
let's say), the plugin will look for the following files to identify which package it belongs to:
/path/to/node_modules/a/b/c/package.json
/path/to/node_nodules/a/b/package.json
/path/to/node_nodules/a/package.json
In the meantime I was able to test beta.2. It seems to work with our symlinked node_modules. I'm almost done with going through internal legal approval so that I can contribute the bugfix back to you for V1.
We basically have a docker container that has a node_modules directory somewhere. This directory will be sym-linked into the source directory. Processing that symlink with license-webpack-plugin doesn't work due to the following problem. At https://github.com/xz64/license-webpack-plugin/blob/f14972b343a0a2641829f786fdc90887120f94ef/src/ModuleProcessor.ts#L18-L20 the existing code simply concatenates the context path with the paths in
modulesDirectories
option. This will work when themodulesDirectories
paths are set as relative paths. If they are absolute or symlinked then later on in this file (seefindModulePrefix
) the paths coming from webpack don't match withthis.modulePrefixes
.My proposal to solve that issue would be:
Is that reasonable? It would solve the absolute path problem and also symlinked node_modules.