Example:
let tmp;
try {
tmp = require('module-name');
} catch(e) {
return;
}
I get error (react native Metro Bundler):
error: bundling failed: Error: Unable to resolve module `module-name` from ...
How to require "module-name" only if exist?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…