appex icon indicating copy to clipboard operation
appex copied to clipboard

Possible issue with require() method?

Open grofit opened this issue 12 years ago • 1 comments

I could be wrong but it looks like you supply your own require("somelib") mechanism via appex to proxy the requires and see if they are TS or JS requests.

Anyway I have an issue where I keep getting errors saying HTMLElement, Element, Document etc dont exist when including other d.ts files. Apparently the typsecript lib contains these types, and although they are not used entirely they still need to be satisfied for the npm to work.

This may not be an issue with appex, but I just wanted to find out if there was some proxying going on so I can rule things out.

grofit avatar Nov 26 '13 16:11 grofit

I am finding another issue at the moment which is hard to track down as it keeps giving me max stack size exceptions within the vm.js

I have an appex module which has a reference to a poco which has a require statement in and some *.d.ts files linked. The file being referenced seems perfectly fine as it is compiled by tsc correctly and output without error. So I can only assume the file is fine but appex refuses to start with this reference... here is an example:

///<reference path="../../../typescript-descriptors/knockout/knockout.d.ts"/>
///<reference path="../../../typescript-descriptors/knockout.validation/knockout.validation.d.ts"/>
///<reference path="../../../typescript-descriptors/node/node.d.ts"/>
var ko: KnockoutStatic = require("knockout");
require("knockout.validation");

module Shared.Models
{
    export class UserCredentials
    {
        public Username = ko.observable("");
        public Password = ko.observable("");

        constructor()
        {
            this.Username.extend({ required: true, minLength: 6, maxLength: 20, alphaNumeric: true });
            this.Password.extend({ required: true, minLength: 6, maxLength: 20 });
        }
    }
}
/// <reference path="../../../node_modules/appex/appex.d.ts" />
/// <reference path="../../game-systems/shared/models/user-credentials.ts" />

export module test
{
    export function index(context)
    {
          context.response.send(200, "called");
    }
}

So with the above reference in the module file to the user-credentials it just blows up without a relevant error, just max stack size.

If I manually hack up the node_modules appex uses I can extract the following exception with try catches littered throughout:

[RangeError: Maximum call stack size exceeded]
/var/lib/stickshift/529ce7905973ca65430003e7/app-root/data/699157/node_modules/appex/index.js:746
                    this.accessor(context);
                  ^
TypeError: Property 'accessor' of object #<IndexRoute> is not a function
    at IndexRoute.invoke (/var/lib/stickshift/529ce7905973ca65430003e7/app-root/data/699157/node_modules/appex/index.js:746:26)
    at IndexRoute.handler (/var/lib/stickshift/529ce7905973ca65430003e7/app-root/data/699157/node_modules/appex/index.js:760:26)
    at ModuleRouter.handler (/var/lib/stickshift/529ce7905973ca65430003e7/app-root/data/699157/node_modules/appex/index.js:810:42)
    at /var/lib/stickshift/529ce7905973ca65430003e7/app-root/data/699157/node_modules/appex/index.js:941:51
    at Waiter.delegate (/var/lib/stickshift/529ce7905973ca65430003e7/app-root/data/699157/node_modules/appex/index.js:1024:25)
    at Worker.dispatch (/var/lib/stickshift/529ce7905973ca65430003e7/app-root/data/699157/node_modules/appex/index.js:6028:41)
    at ChildProcess. (/var/lib/stickshift/529ce7905973ca65430003e7/app-root/data/699157/node_modules/appex/index.js:6020:26)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at handleMessage (child_process.js:318:10)
    at Pipe.channel.onread (child_process.js:345:11)

grofit avatar Dec 05 '13 16:12 grofit