We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently a store build hides Ti.API.debug output but it still is in the code and gets executed
Ti.API.debug
let i = 0; let c = 0; Ti.API.info(`-------------INFO: ${++i}`); console.log(`-------------LOG: ${++c}`); Ti.API.debug(`-------------DEBUG: ${++i}`); console.debug(`-------------LOG DEBUG: ${++c}`); Ti.API.info(`-------------INFO: ${++i}`); console.log(`-------------LOG: ${++c}`);
will output
TiAPI : -------------INFO: 1 TiAPI : -------------LOG: 1 TiAPI : -------------INFO: 3 TiAPI : -------------LOG: 3
in a store build. While the log is gone it still calls the line.
Having heavy JSON.stringify parts in there could potentially slow down the app without doing anything.
In the old Appc blog post about babel modules it will talk about babel-plugin-transform-remove-console that can be used to remove console.debug lines from the code. There is already babel-plugin-transform-titanium to optimize code for e.g. OS_ANDROID calls. So perhaps it would be interesting to add something like the minify flag to https://github.com/tidev/node-titanium-sdk/blob/master/lib/jsanalyze.js to completely remove .debug logs from a store build instead of not just outputting it.
console.debug
OS_ANDROID
.debug
Android & iOS
The text was updated successfully, but these errors were encountered:
Did some tests already and
CallExpression(path, state) { const callee = path.get("callee"); if (!callee.isMemberExpression()) return; if (path.get('callee').matchesPattern('Ti.API.debug')) { path.replaceWith(types.nullLiteral()); } else if (path.get('callee').matchesPattern('Titanium.API.debug')) { path.replaceWith(types.nullLiteral()); } },
in https://github.com/tidev/node-titanium-sdk/blob/master/lib/babel-plugins/ti-api.js#L92 will already NULL all debug calls.
It can be done as a different babel-plugin file (remove-debug-lines) and load it
remove-debug-lines
options.plugins.push(require.resolve('./babel-plugins/remove-debug-lines'));
in the minify block https://github.com/tidev/node-titanium-sdk/blob/master/lib/jsanalyze.js#L152 since that is called during a production run.
Sorry, something went wrong.
SDK PR: #13838 node-titanium-sdk PR: tidev/node-titanium-sdk#651
Successfully merging a pull request may close this issue.
I have searched and made sure there are no existing issues for the issue I am filing
Description
Currently a store build hides
Ti.API.debug
output but it still is in the code and gets executedwill output
in a store build. While the log is gone it still calls the line.
Having heavy JSON.stringify parts in there could potentially slow down the app without doing anything.
Solution
In the old Appc blog post about babel modules it will talk about babel-plugin-transform-remove-console that can be used to remove
console.debug
lines from the code. There is already babel-plugin-transform-titanium to optimize code for e.g.OS_ANDROID
calls.So perhaps it would be interesting to add something like the minify flag to https://github.com/tidev/node-titanium-sdk/blob/master/lib/jsanalyze.js to completely remove
.debug
logs from a store build instead of not just outputting it.Alternatives
Platforms
Android & iOS
The text was updated successfully, but these errors were encountered: