M
M
mletov2017-10-29 12:52:02
ASP.NET
mletov, 2017-10-29 12:52:02

How to work with a bunch of ASP.NET Core, React and npm?

Please tell me:
I decided to master React and plugins for it, and attach all this goodness to my project on ASP.NET Core.
Googled it, installed node.js. jsx files are executing normally, but then I got stuck, I don’t even know which way to google:
1) When npm is executed, all client scripts pulled up get into the /node_modules folder in the root of the project. In reality, static files from the project root are located in the wwwroot folder. It turns out that in order for files to be included in html via script src, you need to copy files from the project root to the root of the web application in wwwroot, so that there is wwwroot/node_modules, which is wrong. Is it configured somewhere?
2) When I try to install the adazzle grid via npm, I get an error
"npm : npm WARN deprecated [email protected]: react-tools is deprecated. For more information, visit https://fb.me/react-tools-deprecated
At line:1 char:1
+ npm install adazzle- react-grid --save
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( npm WARN deprec...ools-deprecated:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError"
Googled, it is advised to update either one package or another, but the specific cause of the error could not be found.
3) The simplest jsx are executed when connected, but at the same time I tried to connect some files, I get the type "require not defined". Do you need any other libraries?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman, 2017-10-29
@mletov

Webpack is here to help. For example https://medium.com/@MaartenSikkema/using-react-red...

E
eRKa, 2017-10-29
@kttotto

If you decide to do a spa, then I would not advise mixing the front with the asp part. It is better to move the entire front part into a separate project, and already give the collected index to the asp project and use it simply as a web api. Then nothing will interfere.

A
as_molchanov, 2017-12-24
@as_molchanov

You can see how the React + SignalR + ASP.NET Core bundle works in the project https://github.com/directlinkcore/directlink

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question