I develop SPA web applicaton using ASP.Net Core React+Redux.
After update to .Net Core 3.0 I see that UseWebpackDevMiddleware and AddNodeServices is obsolete.
I learn new project-template React+Redux, but it isn't use webpack or SSR.
1) Where I can find example or information of work with webpack in .Net Core 3.0? with UseWebpackDevMiddleware was realy easy to configure HMR and webpack build.
2) Where I can find example or information about SSR with .Net 3.0 + React?
A Single Page Application (SPA) is a popular type of web application due to its inherent rich user experience. Integrating client-side SPA frameworks or libraries, such as Angular or React, with server-side frameworks such as ASP.NET Core can be difficult.
SourcePath. Gets or sets the path, relative to the application working directory, of the directory that contains the SPA source files during development. The directory may not exist in published applications.
NET Core 3.1 was originally released on December 3, 2019 and is supported for three years. But the actual end of support day will be the closest Patch Tuesday starting that date, which is December 13, 2022.
Single-Page Applications (SPAs) are Web apps that load a single HTML page and dynamically update that page as the user interacts with the app. SPAs use AJAX and HTML5 to create fluid and responsive Web apps, without constant page reloads. However, this means much of the work happens on the client side, in JavaScript.
I feel I am in the same boat as yourself!!! Having spent the last week or so since the official release of dotnetcore3, I've tried to get something up and running that uses a SPA framework.
Given there has been no answers for this and I am keen to get SPA services running for aspnetcore3
I have looked into the various templates supplied within Visual Studio. Currently the templates are Angular
and React
that use aspnetcore3
.
Prior to this there are templates for Angular
, React
and also Aurelia
. For me Aurelia looks great - vanilla typescript bindings. So I am trying to go down that route.
I managed to get HMR
(Hot Module Replacement) working. I built an Aurelia project using the CLI. However, my project has a lot of configuration, and I am still learning WebPack
. HMR does not currently work with Aurelia CSS.
For my scenario, I had the client app loaded in VS Code. I created an aspnet core project which then hooks into webpack.
I know you are asking specifically about React, but the concept could be the same.
You can find my code here:
https://github.com/andez2000/spa-apps/tree/master/aurelia-cli/e1/aurelia-app
NOTE: Currently I am just dumping stuff into this repo. There are projects created from the templates if you navigate to the top level.
spa-apps\aurelia-cli\e1\aurelia-app
in VSCode
project.csproj
in VS2019
VSCode
and run npm start -- --hmr
and wait for output to complete.VS2019
This should open the default browser and load the index.ejs.
The port numbers in the dotnet project and the aurelia project must tie up.
Startup.cs
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
...
app.UseSpa(spa =>
{
if (env.IsDevelopment())
{
spa.UseProxyToSpaDevelopmentServer("http://localhost:5000");
}
});
}
aurelia.json
"platform": {
"hmr": false,
"open": false,
"port": 5000,
"host": "localhost",
"output": "wwwroot/dist"
},
So maybe this is conceptually the same as React. For some reason my React template fails to connect to IIS Express - and it worked the other day - so not really in a position to go digging.
For me, this project has a lot of moving parts. I wish I had a minimal working solution - that comprises webpack + scss + some spa framework + dotnetcore3. But there is a tonne of configuration and lots of files.
Also it might be worth checking this blog post out:
https://www.alexdresko.com/2019/07/09/htmlwebpackplugin-asp-net-core-3/
Read more about aurelia here:
https://aurelia.io/
Hopefully someone will give you a better answer - but this might get you going. Hopefully Microsoft will update the docs and examples and provide us with some better guidance.
I am hoping updated templates might overcome the aspnet core/dotnet core differences with webpack. So hoping it's a case of pulling in new templates.
See here:
https://github.com/NetCoreTemplates/aurelia-spa
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With