2

Trying to use babel to compile some code in C#/.NET project, following the example https://babeljs.io/setup#installation for C#/.NET.

Installed the package React.Core using NuGet Package Manager (Install-Package React.Core) in a simple Hello world project (https://learn.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio-code).

using System;
using React;
//using React.Web;
//using React.TinyIoC;

//using React.Web.Mvc4;
//using React.Web.TinyIoC;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
           // Console.WriteLine("Hello World!");

            var babel = ReactEnvironment.Current.Babel;
            // Transpiles a file
            // You can instead use `TransformFileWithSourceMap` if you want a source map too.
           // var result = babel.TransformFile("foo.js");
            // Transpiles a piece of code
            var result = babel.Transform("class Foo { }");
            Console.WriteLine(result);
        }
    }
}

Alls getting error at: Unhandled Exception: React.TinyIoC.TinyIoCResolutionException: Unable to resolve type: React.IReactEnvironment at React.TinyIoC.TinyIoCContainer.ResolveInternal

following this post tried adding the package React.Web and React.Web.Mvc4 but still get the same error, am importing the wrong packages?? or what is it? the version of the packages React.Core and the other are 5.1.0

H.C
  • 565
  • 7
  • 28

0 Answers0