修复 jssdk 改成内部模块化加载器后的报错

This commit is contained in:
2betop 2020-06-28 17:15:20 +08:00
parent 1657929a33
commit d839a0a963
2 changed files with 6 additions and 8 deletions

View File

@ -132,13 +132,11 @@ module.exports = function (ret, pack, settings, opt) {
} catch (e) {
d = (/((?:https?|file)\:.*)$/.test(e.stack) && RegExp.$1).replace(/\\/[^\\/]*$/, '');
}
${contents.replace(/\"url\"\s*\:\s*('|")(\.\/.*)\1/g, function (
_,
quote,
value
) {
return `"url": d + ${quote}${value.substring(1)}${quote}`;
})}
${contents
.replace(/\"url\"\s*\:\s*('|")(\.\/.*)\1/g, function (_, quote, value) {
return `"url": d + ${quote}${value.substring(1)}${quote}`;
})
.replace(/require\.resourceMap/, 'amis.require.resourceMap')}
})()`;
}

View File

@ -30,7 +30,7 @@ function amisRequire(...args: Array<any>) {
let id = args.shift();
id = Array.isArray(id) ? id.map(id => mapping[id] || id) : mapping[id] || id;
args.unshift(id);
return require.apply(this, args);
return amis.require.apply(this, args);
}
(window as any).amisRequire = amisRequire;