This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Call to Node module failed with error: TypeError: Cannot read property 'filter' of undefined #358
Closed
Description
Hi,
Following the Microsoft.AspNetCore.SpaServices tutorial, I've faced the above exception. After a little research, I've found that the exception is raised, if the webpack's configuration doesn't contain plugins
field. See the following stack-trace:
System.Exception: Call to Node module failed with error: TypeError: Cannot read property 'filter' of null
at /home/george/projects/todolist/node_modules/aspnet-webpack/LoadViaWebpack.js:80:54
at loadViaWebpackNoCache (/home/george/projects/todolist/node_modules/aspnet-webpack/LoadViaWebpack.js:34:12)
at Object.loadViaWebpack (/home/george/projects/todolist/node_modules/aspnet-webpack/LoadViaWebpack.js:19:49)
at findBootModule (/home/george/projects/todolist/node_modules/aspnet-prerendering/Prerendering.js:95:29)
at findBootFunc (/home/george/projects/todolist/node_modules/aspnet-prerendering/Prerendering.js:103:5)
at renderToString (/home/george/projects/todolist/node_modules/aspnet-prerendering/Prerendering.js:10:5)
at module.exports.renderToString (/tmp/tmpryJ0kL.tmp:19:46)
at /tmp/tmpmiEDvI.tmp:113:19
at IncomingMessage.<anonymous> (/tmp/tmpmiEDvI.tmp:132:38)
at emitNone (events.js:86:13)
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext()
I've checked the JavaScriptServices/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/LoadViaWebpack.ts
file and found that there is no test of an absent plugins
field(lines 93 and 109). Since this field is not required, it needs to check that the field exists before manipulating it. As a workaround, I have added the plugins
field with an empty array as its value to my configuration and all works as expected.
Metadata
Metadata
Assignees
Labels
No labels