Skip to content
Snippets Groups Projects

Fix registering npm linked components

Closed Tamlyn Rhodes requested to merge components-require-relative into master
4 files
+ 8
2
Compare changes
  • Side-by-side
  • Inline
Files
4
const logger = require('@pubsweet/logger')
const logger = require('@pubsweet/logger')
const config = require('config')
const config = require('config')
 
const requireRelative = require('require-relative')
module.exports = app => {
module.exports = app => {
if (config.has('pubsweet.components')) {
if (config.has('pubsweet.components')) {
config.get('pubsweet.components').forEach(name => {
config.get('pubsweet.components').forEach(name => {
const component = require(name)
const component = requireRelative(name)
logger.info('Registered component', name)
logger.info('Registered component', name)
const backendComponent = component.server || component.backend
const backendComponent = component.server || component.backend
if (backendComponent) {
if (backendComponent) {