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.

WebPack SPA Services: "cannot find module" when ProjectPath is a different directory #573

Closed
@harsimranb

Description

@harsimranb

My react code is stored in the "Web.Platform/Web.Client" directory and my Asp.Net Core application code is stored in "Web.Platform/Web".

app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
 {
     HotModuleReplacement = true,
     ReactHotModuleReplacement = true,
     ConfigFile = @"webpack.config.js",
     ProjectPath = @"..\Web.Client\"
});

When I run my project, I get the following error:

System.AggregateException was unhandled by user code
  HResult=-2146233088
  Message=One or more errors occurred. (Call to Node module failed with error: Error: Cannot find module '..\Web.Client\webpack.config.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.resolve (internal/module.js:27:19)
    at Object.requireNewCopy (C:\Web.Platform\Web.Client\node_modules\aspnet-webpack\RequireNewCopy.js:6:34)
    at createWebpackDevServer (C:\Web.Platform\Web.Client\node_modules\aspnet-webpack\WebpackDevMiddleware.js:133:47)
    at createWebpackDevServer (C:\Users\harsimranb\AppData\Local\Temp\tmp5544.tmp:74:50)
    at C:\Users\harsimranb\AppData\Local\Temp\tmp5601.tmp:113:19
    at IncomingMessage.<anonymous> (C:\Users\harsimranb\AppData\Local\Temp\tmp5601.tmp:132:38)
    at emitNone (events.js:86:13)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12))
  Source=System.Private.CoreLib
  StackTrace:
       at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
       at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
       at Microsoft.AspNetCore.Builder.WebpackDevMiddleware.UseWebpackDevMiddleware(IApplicationBuilder appBuilder, WebpackDevMiddlewareOptions options)
       at Web.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IHttpContextAccessor accessor) in C:\Web.Platform\Web\Startup.cs:line 115

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