Search code examples
asp.netreactjsecmascript-6bundling-and-minificationbabeljs

Using BabelBundle on asp.net application, when using BundleResolver is not working


In this moment I'm covert my buddleconfig to support babel transcription. For do that I have the following code:

bundles.Add(new BabelBundle(BundlesVirtualPaths.HeaderApp).Include(
                "~/Scripts/MobileApp/Apps/HeaderApp.js",
                "~/Scripts/MobileApp/Controllers/HeaderCtrl.js"
            ));

Then, I what to get all scripts URL's in a List of string format as follows:

List<string> list =  new BundleResolver().GetBundleContents(virtualPath).ToList();

But the compiler retrives the following error:

Unable to resolve type: React.IReactEnvironment


Solution

  • After a search a lot and tried different solutions, the problem was that my project missed some libraries references.

    Using the Nugget and this post I was able to solve the problem