always name generated file app.min.js so client-side can load it without knowing source is .ts or .js

--> fixes client-side initiated load errors
This commit is contained in:
Ralf Becker 2021-07-19 08:31:06 +02:00
parent ce0a513187
commit 59ac3f4bda
3 changed files with 9 additions and 12 deletions

View File

@ -396,17 +396,14 @@ egwFnct.prototype.setValue = function(_value)
// check if we need a not yet included app.js object --> include it now and re-set when it arrives
else if (i === 1 && typeof app.classes[parts[1]] === "undefined")
{
var self = this;
return new Promise(function(resolve)
{
egw.includeJS("/"+parts[1]+"/js/app.js", function ()
{
if(typeof app.classes[parts[i]] !== "undefined")
return import(egw.webserverUrl+"/"+parts[1]+"/js/app.min.js?"+((new Date).valueOf()/86400|0).toString())
.then(() => {
if(typeof app.classes[parts[i]] === "undefined")
{
resolve(this.setValue(_value));
throw new Error("app.classes."+parts[i]+" not found!");
}
}.bind(this), self, egw.webserverUrl);
}.bind(this));
this.setValue(_value);
});
}
// check if we need a not yet instantiated app.js object --> instantiate it now
else if (i === 1 && typeof app.classes[parts[1]] === "function")

View File

@ -575,9 +575,9 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
// check if we need a not yet included app.js object --> include it now and return a Promise
else if (i == 1 && parts[0] == 'app' && typeof app.classes[parts[1]] === 'undefined')
{
return import(this.webserverUrl+'/'+parts[1]+'/js/app.js?'+((new Date).valueOf()/86400|0).toString())
return import(this.webserverUrl+'/'+parts[1]+'/js/app.min.js?'+((new Date).valueOf()/86400|0).toString())
.then(() => this.applyFunc(_func, args, _context),
(err) => {console.error("Failure loading /"+parts[1]+'/js/app.js' + " (" + err + ")\nAborting.")});
(err) => {console.error("Failure loading /"+parts[1]+'/js/app.min.js' + " (" + err + ")\nAborting.")});
}
// check if we need a not yet instantiated app.js object --> instantiate it now
else if (i == 1 && parts[0] == 'app' && typeof app.classes[parts[1]] === 'function')

View File

@ -154,7 +154,7 @@ export default function addAppsConfig()
{
try {
statSync(file.name + '/js/app.ts');
config.input[file.name + '/js/app'] = file.name + '/js/app.ts';
config.input[file.name + '/js/app.min'] = file.name + '/js/app.ts';
}
catch (e) {
try {