[TIMOB-24791] Android: SDK 6_X_X issue with local JS require
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 6.0.0, Release 6.1.0, Release 6.0.4 |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Ibrahim MESLEM |
Assignee | Unknown |
Created | 2017-06-07T09:14:07.000+0000 |
Updated | 2018-02-28T19:55:03.000+0000 |
Description
Hello,
I am facing an issue since the SDK 6_X_X on android , where i have the issue bellow
*[ERROR] : TiExceptionHandler: (main) [125,125] ----- Titanium Javascript Runtime Error -----
[ERROR] : TiExceptionHandler: (main) [0,125] - In ti:/module.js:303,2
[ERROR] : TiExceptionHandler: (main) [0,125] - Message: Uncaught Error: Requested module not found: crypto-js/hmac
[ERROR] : TiExceptionHandler: (main) [0,125] - Source: throw new Error("Requested module not found: " + request); // TODO Set 'code' property to 'MODULE_NOT_FOUND' to match Node?
[ERROR] : V8Exception: Exception occurred at ti:/module.js:303: Uncaught Error: Requested module not found: crypto-js/hmac
*
The same lib working fine on 5_5_X, could you please help me with this.
Best regards.
Hey there, is the same happening for 6.1.0.GA?
Hey , yes :(
Thank you! Can you attach the file that caused the issue and an example code triggering the error as well?
yes ofcourse, This is the lib that im using https://drive.google.com/file/d/0B7S72-3VTSUfenZIb0xUOTBnUHM/view?usp=sharing var CryptoJS = require(crypto-js/aes);
[~bahinapster] We'd need to know the folder structure of your app (specifically the file calling require and the crypto-js/aes file). "Legacy"-style requires with no prefix should still be handled and assumed to be relative to your Resources folder (so
require('crypto-js/aes')
should look forResources/crypto-js/aes.js
) - but are now discouraged in favor of either explicitly absolute or relative require paths (i.e.require('./crypto-js/aes')
to look relative to the current file,require('/crypto-js/aes')
to look atResources/crypto-js/aes.js
)Both lib and my file are under app/lib as bellow app/lib/crypto-js app/lib/myfile.js
Minimal test case
Add the below to your titanium project (assuming classic here)
Build for Android
I am able to fix this by either removing the nested iife in index.js or returning that iife. I tried this on iOS and it appears to load fine, -I have not tried Windows- Update: Window works as expected Removed foo.js file as index.js is enough to repro