繁体   English   中英

早午餐js检查模块在要求之前存在

[英]Brunch js check module exists before require

我尝试使用早午餐来尝试检查模块是否存在,然后再尝试要求它停止错误。

未捕获的错误:找不到模块“ xxxxx”

if(require("filename")){
   require("filename"); 
}

但这是行不通的。

我使用了try-catch来阻止它出错。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM