Can a node module consisting of Facebook React code work within ASP.NET Core?

41 Views Asked by At

ASP.NET has a nuget package called ReactJS.net which is capable of running Facebook React v16+ code.

I'd like to integrate Office UI Fabric, but the react package is only available as an NPM package, where I'd run

npm install office-ui-fabric-react --save

Is it possible to take the contents of this code and integrate it into ASP.NET (MVC/Core)?

  • Should I "do something" with the github source and add it to my code? (e.g. rename the necessary files to jsx)
  • Should I create a temporary node project, install the package, and manually copy data over?
  • Is there another way I'm not listing (a utility, etc)
1

There are 1 best solutions below

0
On

I have not used the ASP.NET ReactJS.net Plugin, but from what I can gather it requires you to generate a bundle that contains all the dependencies you want to use with it and include in your ASP.net template.

To create a bundle that excludes react from the office-ui-fabric-react module, I would use webpack to build the bundle and the exclude react as a dependency bundled in the bundle.

https://webpack.js.org/configuration/externals/