I am getting the following error message when running webpack.
The oddity is that on my machine, it works fine. This is an old project nearly 10 years old that. Another developer is now going to be working on it and so we have set up his machine to be identical to mine. But this exception is thrown, and it is not clear what is causing this.
This is an Aurelia 1.0 app using webpack 2.6.1. Using .net framework 4.8.0 on the backend in Visual Studio 2022 and running webpack using the Task Runner Explorer.
Any suggestions would be appreciated. Have been stuck on this for a while.
C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE> cmd /c SET NODE_ENV=development&& webpack --color
C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\lib\FlagDependencyUsagePlugin.js:56
const oldUsed = module.used;
^
TypeError: Cannot read properties of null (reading 'used')
at processDependency (C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\lib\FlagDependencyUsagePlugin.js:56:29)
at C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\lib\FlagDependencyUsagePlugin.js:46:43
at Array.forEach (<anonymous>)
at processDependenciesBlock (C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\lib\FlagDependencyUsagePlugin.js:46:28)
at Compilation.<anonymous> (C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\lib\FlagDependencyUsagePlugin.js:23:6)
at Compilation.applyPluginsBailResult1 (C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\node_modules\tapable\lib\Tapable.js:140:27)
at Compilation.seal (C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\lib\Compilation.js:571:9)
at C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\lib\Compiler.js:493:16
at C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\node_modules\tapable\lib\Tapable.js:289:11
at C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\lib\Compilation.js:481:11
at C:\Dev\azure.dev.com\CSS.CRM.Jackpot\OE\node_modules\webpack\lib\Compilation.js:452:13
at processTicksAndRejections (node:internal/process/task_queues:78:11)
Process terminated with code 1.
This is the webpack code that is throwing the exception:
function processDependency(dep) {
const reference = dep.getReference && dep.getReference();
if(!reference) return;
const module = reference.module;
const importedNames = reference.importedNames;
const oldUsed = module.used;
const oldUsedExports = module.usedExports;
if(!oldUsed || (importedNames && (!oldUsedExports || !isSubset(oldUsedExports, importedNames)))) {
processModule(module, importedNames);
}
}
Have tried:
This was finally debugged.
Turns out it was a problem with the correct Typescript tools not being installed on the machine. So there was no javascript files for webpack to compile.
Once the correct tools were installed, then webpack ran as expected to completion.
So if you see the above error message, check to see if the js files are being compiled from TS. If not, that is the actual problem that needs to be resolved.