diff --git a/build/embed-packager.js b/build/embed-packager.js index 4c09777ef..1f5fb5e9d 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 b0c640942..d5664223c 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;