fix: 修复在Windows下require插件报错的问题

This commit is contained in:
coding 2017-10-23 13:12:15 +00:00
parent 898872a88f
commit 4cb597e63e
2 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId> <groupId>pw.yumc</groupId>
<artifactId>MiaoScript</artifactId> <artifactId>MiaoScript</artifactId>
<version>1.1.2</version> <version>1.1.3</version>
<developers> <developers>
<developer> <developer>
<id>502647092</id> <id>502647092</id>

View File

@ -89,7 +89,7 @@
if (optional.hook) { if (optional.hook) {
origin = optional.hook(origin); 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 可以保留行号和文件名称 // 使用 load 可以保留行号和文件名称
var obj = load(cacheFile); var obj = load(cacheFile);
base.delete(cacheFile); base.delete(cacheFile);
@ -149,7 +149,7 @@
* @private * @private
*/ */
function _require(name, path, optional) { function _require(name, path, optional) {
var file = resolve(name, path); var file = _canonical(name) ? name : resolve(name, path);
if (file === undefined) { if (file === undefined) {
log.console("§c模块 §a%s §c加载失败! §4未找到该模块!", name); log.console("§c模块 §a%s §c加载失败! §4未找到该模块!", name);
return {exports:{}}; return {exports:{}};