Skip to content

Cant use custom node_modules with --shadow #526

@bert-w

Description

@bert-w

My app contains custom node modules which are installed into the lib directory, including:

app/lib/node_modules/qs which is a querystring module from npm, see https://www.npmjs.com/package/qs .

However when building with --shadow, the runtime appears to be looking for another module:

[DEBUG] [iphone, 10.1, undefined] Native module:node_modules/qs
[ERROR] [iphone, 10.1, undefined] Couldn't find module: node_modules/qs for architecture: x86_64
[ERROR] [iphone, 10.1, undefined] TypeError: undefined is not an object (evaluating '__p.require("node_modules/qs").stringify')

So to reproduce: install this npm package (qs@5.2.0), and call it anywhere in your titanium code using require('node_modules/qs').stringify({foo: 'bar'});.

I can fix it using require('node_modules/qs/lib/index')... (direct reference to the bootstrap file) but I'm quite sure there's an underlying tishadow issue here.

I'm using Ti 6.0.1.GA, Alloy 1.9.5, and npm/qs@5.2.0

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions