From 4cb597e63eafd6f011044482d2e79a763daeecfb Mon Sep 17 00:00:00 2001 From: coding Date: Mon, 23 Oct 2017 13:12:15 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8Windows?= =?UTF-8?q?=E4=B8=8Brequire=E6=8F=92=E4=BB=B6=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- src/main/resources/core/require.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 6c82e12..c8cd7aa 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 pw.yumc MiaoScript - 1.1.2 + 1.1.3 502647092 diff --git a/src/main/resources/core/require.js b/src/main/resources/core/require.js index 7bc463b..88c2468 100644 --- a/src/main/resources/core/require.js +++ b/src/main/resources/core/require.js @@ -89,7 +89,7 @@ if (optional.hook) { origin = optional.hook(origin); } - base.save(cacheFile, "(function (module, exports, require, __DIR__, __FILE__) {" + origin + "});"); + base.save(cacheFile, "(function (module, exports, require, __dirname, __filename) {" + origin + "});"); // 使用 load 可以保留行号和文件名称 var obj = load(cacheFile); base.delete(cacheFile); @@ -149,7 +149,7 @@ * @private */ function _require(name, path, optional) { - var file = resolve(name, path); + var file = _canonical(name) ? name : resolve(name, path); if (file === undefined) { log.console("§c模块 §a%s §c加载失败! §4未找到该模块!", name); return {exports:{}};