Skip to content
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
@d4rw1n1s7

Description

@d4rw1n1s7

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions