dotnet-local configuration for require.js modules?
-
I'm using the command line sample described here:
https://jsreport.net/learn/dotnet-local
And when I go to run the Orders report, I get:
Unsupported module in scripts: http. To enable require on particular module, you need to update the configuration as {"scripts": { "allowedModules": ["http"] } } ... Alte
How do I configure this in jsreport.local so I can play with that report - I've tried a few things and they didn't work (i.e. yield other errors).
-
FWIW - I figured it out - at first I tried "http" and "[http]" for AllowedModules - but that didn't work for some reason, but * does work - the example should be something like this:
var scfg = new jsreport.Types.Configuration() { Scripts = new jsreport.Types.ScriptsConfiguration() { AllowedModules = "*" } }; var path = Path.Combine(Directory.GetCurrentDirectory(), "jsreport"); var rs = new LocalReporting() .UseBinary(JsReportBinary.GetBinary()) .KillRunningJsReportProcesses() .RunInDirectory(path) .Configure(cfg => scfg.CreateSamples().FileSystemStore().BaseUrlAsWorkingDirectory()) .AsWebServer() .RedirectOutputToConsole() .Create();
FWIW - I also think you should change it so the jsreport folder gets created in the project folder instead of in the bin folder - then it would be easy to keep everything in version control as well as in your database.
-
FWIW - I figured it out - at first I tried "http" and "[http]" for AllowedModules - but that didn't work for some reason, but * does work - the example should be something like this
You can also use
.Configure(cfg =>cfg.AllowLocalFilesAccess())
instead. You can see here it does the same.FWIW - I also think you should change it so the jsreport folder gets created in the project folder instead of in the bin folder - then it would be easy to keep everything in version control as well as in your database.
Thank you for recommendation.I will give it again some thoughts. For now I consider running jsreport studio and web server through
jsreport.Local
as advanced scenario which requires some additional configuration. Like you have done.