Project: titanium
Issue TIMOB-23383: Parity: Titanium CommonJS modules cannot require relative files
Titanium CommonJS modules have a hard limit to effectively all be contained in a single JS file whose base name matches the module.id. If you have a CommonJS module, not only does it have to have an entry file matching the module id(TIMOB-23382), but that file will fail to require any other files relative to it. For a simple example, I have a {{modules/commonjs/ti.commonjs.require/1.0.0}} folder and inside is: - {{ti.commonjs.require.js}} - {{main.js}} I can do {{require('ti.commonjs.require');}} from my Titanium app, and it'll load the {{modules/commonjs/ti.commonjs.require/1.0.0/ti.commonjs.require.js}} file (regardless of whether I have a package.json pointing to another file or an index.js file there). But if that file has a {{require('./main');}} it'll throw a Runtime error that it's unable to load the main.js module.
Story points: 5