Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
packages.forEach(compPath => {
let resolvedPath = compPath
try {
resolvedPath = resolveComponentPath(compPath, componentRootPath)
if (resolvedPath) {
const requiredComp = require(resolvedPath) // eslint-disable-line global-require, import/no-dynamic-require
registerCustomComponent(requiredComp.default || requiredComp, registerCompFn)
registerDependencies((requiredComp.default || requiredComp).dependencies)
result.success.push(compPath)
}
} catch (e) {
result.failures.push({ error: e, compPath })
if (e.code === 'ENOENT' || e.code === 'MODULE_NOT_FOUND') {
console.error('Missing or unreadable custom component : ', resolvedPath) // eslint-disable-line no-console
} else {
console.error('Error when registering custom component : ', resolvedPath, e) // eslint-disable-line no-console
}
}
})