in src/React.Core/JavaScriptEngineFactory.cs [175:219]
private void LoadUserScripts(IJsEngine engine)
{
try
{
IEnumerable<string> manifestFiles = Enumerable.Empty<string>();
if (_config.ReactAppBuildPath != null)
{
var manifest = ReactAppAssetManifest.LoadManifest(_config, _fileSystem, _cache, useCacheRead: false);
manifestFiles = (manifest?.Entrypoints?.Where(x => x != null && x.EndsWith(".js"))) ?? Enumerable.Empty<string>();
}
foreach (var file in _config.ScriptsWithoutTransform.Concat(manifestFiles))
{
try
{
if (_config.AllowJavaScriptPrecompilation
&& engine.TryExecuteFileWithPrecompilation(_cache, _fileSystem, file))
{
// Do nothing.
}
else
{
engine.ExecuteFile(_fileSystem, file);
}
}
catch (JsException ex)
{
// We can't simply rethrow the exception here, as it's possible this is running
// on a background thread (ie. as a response to a file changing). If we did
// throw the exception here, it would terminate the entire process. Instead,
// save the exception, and then just rethrow it later when getting the engine.
_scriptLoadException = new ReactScriptLoadException(string.Format(
"Error while loading \"{0}\": {1}",
file,
ex.Message
), ex);
}
}
}
catch (IOException ex)
{
// Files could be in the process of being rebuilt by JS build tooling
_scriptLoadException = new ReactScriptLoadException(ex.Message, ex);;
}
}