mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	dont retry absolute paths
This commit is contained in:
		| @@ -37,15 +37,20 @@ Plugins.languageData = {}; | |||||||
| Plugins.initialized = false; | Plugins.initialized = false; | ||||||
|  |  | ||||||
| var defaultRequire = module.require; | var defaultRequire = module.require; | ||||||
| module.require = function () { |  | ||||||
|  | module.require = function (p) { | ||||||
| 	try { | 	try { | ||||||
| 		return defaultRequire.apply(this, arguments); | 		return defaultRequire.apply(module, arguments); | ||||||
| 	} catch (err) { | 	} catch (err) { | ||||||
| 		// if we can't find the module try in parent directory | 		// if we can't find the module try in parent directory | ||||||
| 		// since plugins.js moved into plugins folder | 		// since plugins.js moved into plugins folder | ||||||
| 		if (err.code === 'MODULE_NOT_FOUND') { | 		if (err.code === 'MODULE_NOT_FOUND') { | ||||||
| 			winston.warn('[plugins/require] please update module.parent.require("' + arguments[0] + '") in your plugin!\n' + err.stack.split('\n')[5]); | 			winston.warn('[plugins/require] ' + err.message + ', please update your plugin!\n' + err.stack.split('\n')[5]); | ||||||
| 			return defaultRequire.apply(this, [path.join('../', arguments[0])]); | 			if (path.isAbsolute(p)) { | ||||||
|  | 				throw err; | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			return defaultRequire.apply(module, [path.join('../', p)]); | ||||||
| 		} | 		} | ||||||
| 		throw err; | 		throw err; | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user