aui/tmodjs

win10下npm安装的tmodjs无法生成压缩结果。

wsniper opened this issue · 3 comments

如题: 运行tmod 命令可以生成合并后的template.js,且该文件可以正常使用。只是,无法生成压缩后的文件(已经配置minify:true)。

检查 发现文件
C:\Users\username\AppData\Roaming\npm\node_modules\tmodjs\src\uglify2.js 行:

var sourceMapDir = path.dirname(options.generatedSourceMapName);

中的generatedSourceMapNameJj变量未定义(其他文件中也没有找到相关定义)。暂时改成如下方式可以正常生成压缩文件:

var sourceMapDir = path.dirname(options.generatedSourceMapName || file);

报错如下:

Path must be a string. Received undefined.

at EventEmitter.Tmod._uglify (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:755:23)
at EventEmitter.Tmod._minify (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:789:14)
at EventEmitter.Tmod._buildRuntime (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:724:18)
at EventEmitter.Tmod (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:176:10)
at Object.<anonymous> (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\bin\tmod:179:14)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)

origError:
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.dirname (path.js:697:5)
at C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\uglify2.js:54:33
at Array.forEach (native)
at module.exports (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\uglify2.js:42:11)
at EventEmitter.Tmod._uglify (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:753:22)
at EventEmitter.Tmod._minify (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:789:14)
at EventEmitter.Tmod._buildRuntime (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:724:18)
at EventEmitter.Tmod (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:176:10)
at Object. (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\bin\tmod:179:14) }
• verify/verify-step-tpl :v11

Path must be a string. Received undefined.

at EventEmitter.Tmod._uglify (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:755:23)
at EventEmitter.Tmod._minify (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:789:14)
at EventEmitter.Tmod._buildRuntime (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:724:18)
at EventEmitter.Tmod._combo (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:822:14)
at EventEmitter.Tmod.compile (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:386:22)
at Object.<anonymous> (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\bin\tmod:204:12)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)

origError:
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.dirname (path.js:697:5)
at C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\uglify2.js:54:33
at Array.forEach (native)
at module.exports (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\uglify2.js:42:11)
at EventEmitter.Tmod._uglify (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:753:22)
at EventEmitter.Tmod._minify (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:789:14)
at EventEmitter.Tmod._buildRuntime (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:724:18)
at EventEmitter.Tmod._combo (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:822:14)
at EventEmitter.Tmod.compile (C:\Users\wxy\AppData\Roaming\npm\node_modules\tmodjs\src\tmod.js:386:22) }

Waiting...

用Node.js LTS版本吧,我也是这个问题,换了就好了,当然用你这个方法也可以

+1

直接卡住!!绿色 wating......!! 作者你出来~~