Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Forward native prototype extensions through require #5

@MattiSG

Description

@MattiSG

If I try to evaluate a program that uses a library extending native prototypes, LightTable loses connection with the Node process, saying it crashed, and the console reads the following:

…/LightTable/LightTable.app/Contents/Resources/app.nw/plugins/javascript/node/ltnodeclient.js:99
      vm.runInContext(cleanCode(fs.readFileSync(path)), sb, path);
         ^
TypeError: Object function Object() { [native code] } has no method 'extend'
at …/Watai/src/lib/mootools-additions.js:3:8

Indeed, it seems that the sbRequire function wraps original require calls without sharing prototypes, since all modules are evaluated in their own (shared) context, not in the global context.

For reference, this behavior can be tested by trying to evaluate stuff in Watai’s src/index.js.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions