Search code examples
includecomponentsappceleratorusingappcelerator-alloy

Appcelerator Alloy how to include lib or component?


I would like to use TiRemoteImage from https://github.com/ulizama/TiRemoteImage and in my alloy project I have added lib and components folder in app folder. Then I copy the files in TiRemoteImage's Resources/lib and Resources/components folder into my project's lib and components respectively So my project folder structure looks like this now

app
> assets    
> components    
> controllers    
> lib    
> models
> styles
> views

I have then added

var RemoteImage = require('/components/remoteimage');

in index.js and then my app will just crash without any error. Am I including the component correctly?


Solution

  • You are using Alloy framework and the github project is not an alloy project so you have to copy all modules (.js in components and lib ) in /lib folder and change all line of code like : require("/components/module.js") ou require("/lib/module.js") by require("module.js")