Issue description
After enabling LiveView Ti.include statements are not loaded correctly.
Running app normally works fine. The app has the following similar structure:
alloy.js
Ti.include('testing.js');//File: "app/lib/testing.js"
setConfig("username", "appc_developer");
var name = getConfig("username", 0);
alert(name);
Console Output
[INFO] : Focusing the iOS Simulator
[LiveView] version 1.0.4
[LiveView] File Server Started on Port 8324
[LiveView] Alloy project monitor started
[LiveView] Event Server Started on Port 8323
[INFO] : Application started
[INFO] : TestLiveView/1.0 (3.2.3.GA.b958a70)
[LiveView] Client connected
[ERROR] : Script Error {
[ERROR] : backtrace = "#0 () at file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js:638\n#1 () at file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js:502\n#2 () at file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js:469\n#3 () at file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js:403\n#4 () at file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js:676";
[ERROR] : line = 608;
[ERROR] : message = "'undefined' is not a function (evaluating '_src.replace(/\\/\\/(.*)$/gm, '')')";
[ERROR] : name = TypeError;
[ERROR] : sourceId = 300321376;
[ERROR] : sourceURL = "file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js";
[ERROR] : }
Titanium Classic
LiveView is able to detect changes made by using a Titanium Classic app. To test it out just place "testing.js" into Resources folder and use the following code for replicate:
app.js
Ti.include('testing.js');
setConfig("username", "appc_developer_");
var name = getConfig("username", 0);
alert(name);
Console Output
[INFO] : Focusing the iOS Simulator
[LiveView] version 1.0.4
[LiveView] File Server Started on Port 8324
[LiveView] Event Server Started on Port 8323
[INFO] : Application started
[INFO] : TouchTestIDs/1.0 (3.2.3.GA.b958a70)
[LiveView] Client connected
[INFO] : [object ComAppceleratorApmModule] loaded
[INFO] : [object ComSoastaTouchtestModule] loaded
[LiveView] Reload Triggered
REASON: File Changed
FILE: /Users/egomez/Documents/Appcelerator_Studio_Workspace/TouchTestIDs/Resources/app.js
[LiveView] Client disconnected
[INFO] : [LiveView] Reloading App
[INFO] : UI SHUTDOWN COMPLETE. TRYING TO RESUME RESTART
[INFO] : TouchTestIDs/1.0 (3.2.3.GA.b958a70)
[LiveView] Client connected
testing.js
function setConfig(name, value) {
Titanium.App.Properties.setString(name, value);
}
function getConfig(name, defaultvalue) {
return Titanium.App.Properties.getString(name, defaultvalue);
}
Ti.include should be deprecated and removed as soon as possible. It was a solution to a problem that has long been solved. If you are wanting to include large sections of code in-line then re-think and convert them to CommonJS. Problem solved and much better code in your app.
Per TIMOB-16984, Ti.include is likely to be deprecated. Consider closing this ticket as a result.
Thanks [~skypanther], Client ported everything to CommonJS already. Looking forward to see this in 3.3.0 (Ti.include removed) and official. Close ticket as applicable.
Because Ti.include() has been deprecated, I'm closing this as won't fix.