vue-parent-change-transition
Version:
Animate a child component when it's parent changed.
19 lines (17 loc) • 425 B
JavaScript
const cwd = process.cwd()
const resolve = require('resolve')
// attempts to first require a dep using projects cwd (when vue-loader is linked)
// then try a normal require.
module.exports = function tryRequire (dep) {
let fromCwd
try {
fromCwd = resolve.sync(dep, { basedir: cwd })
} catch (e) {}
if (fromCwd) {
return require(fromCwd)
} else {
try {
return require(dep)
} catch (e) {}
}
}