New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-24642] - Correct require implementation #9030
Conversation
When a path begins with |
@@ -385,6 +385,16 @@ Module.prototype.loadNodeModules = function (moduleId, startDir, context) { | |||
*/ | |||
Module.prototype.nodeModulesPaths = function (startDir) { | |||
// 1. let PARTS = path split(START) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this comment back down to the line it's referencing below.
@ewanharris It'd be useful to add some tests around this in our test suite so we know the issue is fixed, and to verify some of the things we're discussing here. Copy https://github.com/appcelerator/titanium-mobile-mocha-suite/blob/master/Resources/ti.require.test.js in As for what @cb1kenobi is talking about, I don't believe we do search for node_modules when the require path is prefixed by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting unit tests be added to verify the bug is fixed.
This commit also fixes the path construction to split the array and not the string
@sgtcoolguy Addressed your comments, added the following tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passed FR!
Node Version: 6.10.1
NPM Version: 3.10.10
Mac OS: 10.12.4
Appc CLI: 6.2.0
Appc CLI NPM: 4.2.9
Titanium SDK version: 6.2.0.v20170510080439
Appcelerator Studio, build: 4.8.1.201612050850
Xcode 8.3.2
First tested with 6.0.4.GA. The app hangs. I retried with the fix in this PR, and the app launched and displayed a yellow window. FR passed.
JIRA: https://jira.appcelerator.org/browse/TIMOB-24642
Note iOS does not like a leading slash on paths, so '/node_modules' in the below is 'node_modules' on iOS
Test case: