Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26352] CLI: node_modules in project root should be handled properly

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2021-03-01T16:36:37.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.0.0
ComponentsCLI, iOS
Labelsn/a
ReporterHans Knöchel
AssigneeChristopher Williams
Created2018-09-02T16:58:54.000+0000
Updated2021-04-13T12:28:12.000+0000

Description

I tried using ReduxJS in Titanium, but it fails because we do not look-up node_modules correctly. It is installed to node_modules/redux/lib/redux.js, but Titanium does not look there. This seems to be an issue for many many other Node.js modules as well. A workaround is to copy the library to app/lib (Alloy) or Resources (Classic), but that's not how it's handled in modern JS environments, so this should not be the normal workflow. To reproduce: 1. Create a new Ti app 2. Run npm init 3. Run npm i redux --save 4. Add import { createStore } from 'redux' to your app.js / index.js (ES6 enabled) 5. Run your app

Comments

  1. Brenton House 2020-01-23

    I've created a PR that allows you to do npm installs in project root directory and it copies all necessary files to the Resources directory so they can be used at runtime. https://github.com/appcelerator/alloy/pull/950
  2. Christopher Williams 2020-01-24

    WIP PR: https://github.com/appcelerator/titanium_mobile/pull/11447
  3. Christopher Williams 2021-03-01

    Merged to master, manually cherry-picked all commits to 10_0_X branch for 10.0.0 target.

JSON Source