From 65dc92ff9284b696fc7a24b620386e9c9cae648b Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Sun, 28 Jun 2020 17:15:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20jssdk=20=E6=94=B9=E6=88=90?= =?UTF-8?q?=E5=86=85=E9=83=A8=E6=A8=A1=E5=9D=97=E5=8C=96=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=99=A8=E5=90=8E=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/embed-packager.js | 12 +++++------- examples/loader.ts | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/build/embed-packager.js b/build/embed-packager.js index 4c09777e..1f5fb5e9 100644 --- a/build/embed-packager.js +++ b/build/embed-packager.js @@ -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')} })()`; } diff --git a/examples/loader.ts b/examples/loader.ts index b0c64094..d5664223 100644 --- a/examples/loader.ts +++ b/examples/loader.ts @@ -30,7 +30,7 @@ function amisRequire(...args: Array) { 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;