BundleTransformer for fewer complaints "Could not find a factory that creates an instance of the JavaScript engine"

If you are upgrading from version 1 to version 2 of the BundleTransformer, you may receive this message:

Could not find a factory that creates an instance of the JavaScript engine named MsieJsEngine .

Like me, you didn’t even realize that you updated more than just a point release.

How to fix?

+5
source share
2 answers

Version 2 DOES NOT USE WEB.CONFIG for configuration anymore

So start by deleting it and reading the rest of this link

https://github.com/Taritsyn/JavaScriptEngineSwitcher/wiki/How-to-upgrade-applications-to-version-2.X


Basically you will do the following:

  • Removing existing web.config nodes for javscript engine
  • Adding to another place, for example global.asax, the initialization code
  • Install Nuget Packages for the Engines You Want to Use
  • Be sure to add a using statement to be able to use extension methods (if you choose this path)

I got something like this:

  using JavaScriptEngineSwitcher.Core; using JavaScriptEngineSwitcher.Msie; using JavaScriptEngineSwitcher.V8; .... public class JsEngineSwitcherConfig { public static void Configure(JsEngineSwitcher engineSwitcher) { engineSwitcher.EngineFactories .AddMsie(new MsieSettings { UseEcmaScript5Polyfill = true, UseJson2Library = true }) .AddV8(); engineSwitcher.DefaultEngineName = MsieJsEngine.EngineName; } } 
+11
source

I follow the instructions, but my code now breaks into BundleConfig

var cssTransformer = new StyleTransformer ();

The name attribute of the configuration element /configuration/bundleTransformer/less/jsEngine does not specify the name of the JavaScript engine.

If you have not installed the JavaScript engine, then for the correct operation of this module it is recommended to install one of the following NuGet packages: * JavaScriptEngineSwitcher.Msie * JavaScriptEngineSwitcher.V8 * JavaScriptEngineSwitcher.ChakraCore

After installing the package, you must specify the name of the JavaScript engine (for example, MsieJsEngine ) to the attribute name Configuration /configuration/bundleTransformer/less/jsEngine element.

+1
source

Source: https://habr.com/ru/post/1257913/


All Articles