Why?
funnbot opened this issue · comments
Dillon Bayless commented
Why would anyone use this?
Tobias Reich commented
I'm using it to require optional dependencies.
const path = require('path')
const niceTry = require('nice-try')
const junk = require('junk')
const browserSync = niceTry(() => require('browser-sync'))
const cache = require('./cache')
instead of
const path = require('path')
const niceTry = require('nice-try')
const junk = require('junk')
let browserSync
try { browserSync = require('browser-sync') }
catch (e) {}
const cache = require('./cache')
¯\(ツ)/¯