Open StuderAaron opened 2 years ago
What I found was that package.json was include as a module. When LicenseTextReader.prototype.readLicense (LicenseTextReader.js) executes it fails as module.directory is an empty string. As the fix I added the below highlighted line.
Not sure whether this is the correct fix.
Found an immediate workaround for now:
new LicenseWebpackPlugin({
excludedPackageTest(packageName) {
return packageName === '<this module name>'
},
})
(EDIT: Debugged the logic here. Agree with @williamjacobszoon that the inclusion seems to be because of the own module's inclusion [where module.name ===
to the name in package.json] with a module.directory === ''
.)
We ran into this issue when using both html-webpack-plugin and license-webpack-plugin in our project.
excludedPackageTest(packageName) { return packageName === '<this module name>' },
Hi @WorldMaker, in which way you found the name of the causing modul?
@stritti I believe I recall that was some old fashioned console.log
debugging. I think I started with a return true
in that callback, with a console.log(packageName)
and started at the bottom of the list until the error went away.
I get the following Error, when using the plugin on windows (on linux everything works fine):
[webpack-cli] HookWebpackError: ENOENT: no such file or directory, scandir at makeWebpackError (C:\myPath\www\node_modules\webpack\lib\HookWebpackError.js:48:9) at C:\myPath\www\node_modules\webpack\lib\Compilation.js:3060:12 at eval (eval at create (C:\myPath\www\node_modules\tapable\lib\HookCodeFactory.js:33:10),:23:1)
at fn (C:\myPath\www\node_modules\webpack\lib\Compilation.js:480:17)
at _next10 (eval at create (C:\myPath\www\node_modules\tapable\lib\HookCodeFactory.js:33:10), :21:1)
at eval (eval at create (C:\myPath\www\node_modules\tapable\lib\HookCodeFactory.js:33:10), :37:1)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
-- inner error --
Error: ENOENT: no such file or directory, scandir
at Object.readdirSync (node:fs:1420:3)
at CacheBackend.provideSync (C:\myPath\www\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:233:32)
at WebpackFileSystem.listPaths (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackFileSystem.js:78:24)
at LicenseTextReader.readLicense (C:\myPath\www\node_modules\license-webpack-plugin\dist\LicenseTextReader.js:37:54)
at PluginChunkReadHandler.processModule (C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:71:62)
at C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:24:27
at WebpackInnerModuleIterator.internalCallback (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:39:13)
at WebpackInnerModuleIterator.iterateModules (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:21:9)
at C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:20:39
at WebpackChunkModuleIterator.iterateModules (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackChunkModuleIterator.js:42:21)
caused by plugins in Compilation.hooks.processAssets
Error: ENOENT: no such file or directory, scandir
at Object.readdirSync (node:fs:1420:3)
at CacheBackend.provideSync (C:\myPath\www\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:233:32)
at WebpackFileSystem.listPaths (C:\Users\aastuder\Documents\projects\sharedlogic\eclipse-4_13_0-core\belimo-shared-logic.core\ch.belimo. at LicenseTextReader.readLicense (C:\myPath\www\node_modules\license-webpack-plugin\dist\LicenseTextReader.js:37:54)
at PluginChunkReadHandler.processModule (C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:71:62)
at C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:24:27
at WebpackInnerModuleIterator.internalCallback (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:39:13)
at WebpackInnerModuleIterator.iterateModules (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:21:9)
at C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:20:39
at WebpackChunkModuleIterator.iterateModules (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackChunkModuleIterator.js:42:21)
The problem seems to be, that the path is empty (in CachedInputFileSystem:provideSync). Any Ideas?