[FIX] single export TypeError: cannot read properties error#43
Open
debdutdeb wants to merge 1 commit intoRocketChat:masterfrom
Open
[FIX] single export TypeError: cannot read properties error#43debdutdeb wants to merge 1 commit intoRocketChat:masterfrom
TypeError: cannot read properties error#43debdutdeb wants to merge 1 commit intoRocketChat:masterfrom
Conversation
3a5b719 to
e24c356
Compare
Signed-off-by: Debdut Chakraborty <debdut.chakraborty@rocket.chat>
e24c356 to
4eef13f
Compare
d-gubert
requested changes
Mar 10, 2022
Member
There was a problem hiding this comment.
The PR solves that issue, but disregards the comments in the class file:
* However, we need to handle this case due to backwards compatibility,
* since the main class file might export a class with an unknown name,
* which was supported in the early versions of the Apps-Engine.
Which causes apps that don't follow the convention of naming their classes the same as their files to break.
A solution I've found to all these problems is to simply change the if statement in the compiledRequire function as follows:
if (Object.keys(exports).length === 1 && typeof result === 'function') {
return result;
}This way we are handling the older cases more specifically while fixing the problem.
The other changes are not needed.
@debdutdeb can you apply these changes to the PR? :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #41