daxingplay / kmc

module compiler for kissy
MIT License
32 stars 36 forks source link

兼容 `path.extname` 在 node 6.x 版本下强制要求 String #56

Closed dickeylth closed 7 years ago

dickeylth commented 7 years ago

path.extname 在 node 4.x 下传入 undefined 不会报错返回 '',但在 6.x 下会报错:

> path.extname()
TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.extname (path.js:1431:5)
    at repl:1:6
    at sigintHandlersWrap (vm.js:22:35)
    at sigintHandlersWrap (vm.js:73:12)
    at ContextifyScript.Script.runInThisContext (vm.js:21:12)
    at REPLServer.defaultEval (repl.js:346:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:545:10)

因为 grunt-kmc 这一行可能会传入 undefineddepFileName: https://github.com/daxingplay/grunt-kmc/blob/master/tasks/kmc.js#L127