脚本名称命名冲突

ES6 规范里,可以 import 资料夹,并自动查找资料夹底下的 index.js

但在 Cocos Creator 里,会出现命名冲突错误

Error: Filename conflict, the module "index" both defined in "scripts/listeners/index.js" and "scripts/invokers/index.js"

不知道这是 Cocos Creator 的 Bug? 还是 Cocos Creator 一定不能有重复的脚本名称?

你好,目前 Creator 是规定不能有重复的脚本名称。
如果资料夹内的是第三方的插件,建议合并成独立脚本,并且设置为插件,参考 http://www.cocos.com/docs/creator/scripting/plugin-scripts.html

非相同路径也出问题

这个限制有点蛋疼 导致规范没办法做 因为目录底下放index很正常 同时文件那么多 怎么可能一个一个不同命名