[TIMOB-5888] MobileWeb: Build system does not support dynamic filenames in Ti.includes
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-11-15T15:54:22.000+0000 |
Affected Version/s | Release 1.8.0 |
Fix Version/s | Sprint 2011-45, Release 1.8.0.1 |
Components | MobileWeb |
Labels | stage |
Reporter | Chris Barber |
Assignee | Chris Barber |
Created | 2011-10-27T12:53:23.000+0000 |
Updated | 2017-03-04T00:17:39.000+0000 |
Description
The build system attempts to scan the user's application code for all Ti.includes, then will serialize the contents of those includes into the compiled titanium.js.
The problem is when you try to include a file that is dynamically defined:
Ti.include(path + "somefile.js");
The problem takes place in the expand_ti_includes() function of compiler.py. It's important that the function analyzes the filename and determine if it's a valid filename and that the file exists. If it isn't or doesn't exist, don't error, just return. If it does exist, then add it to self.ti_includes[src].
You'll have to test this by building a dummy app and creating a dynamic include, then building the mobile web app. You will need to run builder.py from the command line to see any errors.
You can open the compiled titanium.js file to confirm the includes have been found and inlined properly at the bottom like this:
Ti._5.setLoadedScripts({"shibby.js": "Ti.API.log(\"hi!\");"});
This mechanism needs to also work with require() calls.
Pull request: https://github.com/appcelerator/titanium_mobile/pull/673
Updated pull request: https://github.com/appcelerator/titanium_mobile/pull/703 (I accidentally closed the previous pull request while working on TIMOB-6018)
Closing ticket due to MobileWeb no longer being supported.