From 0b591bdb83c7ea06bd7052fdc2bc094a7a3b4c03 Mon Sep 17 00:00:00 2001 From: coding Date: Thu, 12 Oct 2017 13:07:38 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A8=A1=E5=9D=97=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=5F=5FFILE=5F=5F=20=E5=92=8C=20=5F=5FDIR=5F=5F=20=E5=8F=98?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/core/require.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/core/require.js b/src/main/resources/core/require.js index a6dfdb1..c6cc782 100644 --- a/src/main/resources/core/require.js +++ b/src/main/resources/core/require.js @@ -84,7 +84,7 @@ */ function compileJs(file) { var cacheFile = _cacheFile(file); - base.save(cacheFile, "(function (module, exports, require) {" + base.read(file) + "});"); + base.save(cacheFile, "(function (module, exports, require, __DIR__, __FILE__) {" + base.read(file) + "});"); // 使用 load 可以保留行号和文件名称 var obj = load(cacheFile); base.delete(cacheFile); @@ -110,7 +110,7 @@ try { var compiledWrapper = compileJs(file); compiledWrapper.apply(module.exports, [ - module, module.exports, module.require + module, module.exports, module.require, file.parentFile, file ]); log.d('模块 %s 编译成功!', name); module.loaded = true;