Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23512] Windows: relative require() from sub-directory fails

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-06-28T16:30:53.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.0.0
ComponentsWindows
Labelsn/a
ReporterChristopher Williams
AssigneeKota Iguchi
Created2016-06-13T23:46:31.000+0000
Updated2016-09-07T15:59:54.000+0000

Description

While writing the mocha test suite, I happened to uncover a bug in Windows require() without actually trying to test it! Inside the test app, we have:
- Resources
|-- utilities
|  |-- assertions.js
|  |-- utilities.js
|-- app.js
|-- ti.accelerometer.test.js
/utilities/assertions.js has a require('./utilities'); which is failing to resolve. I believe we're not holding onto the path/dirname of a given module to use as the basis for resolving require calls inside it.
14:22:31 -- Start application log -----------------------------------------------------
14:22:31 [ERROR] :  Application Error: {
14:22:31 [ERROR] :    "line": 2,
14:22:31 [ERROR] :    "column": 10,
14:22:31 [ERROR] :    "message": "Error while require(/app) Error while require(./ti.accelerometer.test) Error while require(./utilities/assertions) Could not load module ./utilities",
14:22:31 [ERROR] :    "native_stack": [
14:22:31 [ERROR] :      "JSExportClass<class Titanium::GlobalObject>::CallNamedFunction"
14:22:31 [ERROR] :    ]
14:22:31 [ERROR] :  }

Comments

  1. Kota Iguchi 2016-06-27

    https://github.com/appcelerator/titanium_mobile_windows/pull/750
  2. Ewan Harris 2016-09-07

    Verified using: OS: Microsoft Windows 10 Pro 10.0.14393 Appc core: Appc NPM: 4.2.8-6 Ti SDK: 6.0.0.v20160907043924 Appc Studio: 4.8.0.201609070852 Lumia 930 (RM-1045) SDK 10.0 Relative require from sub-directory no longer fails Closing ticket

JSON Source