[英]Brunch js check module exists before require
Using brunch I'm trying to do a check for if a module exists before trying to require it to stop an error. 我尝试使用早午餐来尝试检查模块是否存在,然后再尝试要求它停止错误。
Uncaught Error: Cannot find module "xxxxx"
未捕获的错误:找不到模块“ xxxxx”
if(require("filename")){
require("filename");
}
But this does not work. 但这是行不通的。
我使用了try-catch来阻止它出错。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.