简体   繁体   中英

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"

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

But this does not work.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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