I used a try-catch to stop it from erroring.
Brunch js check module exists before require
-
24-06-2022 - |
Frage
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.
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow