You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Hi,

    The Espruino Web IDE usually looks in http://www.espruino.com/modules to find anything you've require()d. However if you go into settings/communications then you should find something called Load modules from NPM (BETA) that you can enable, which will drag modules off NPM (assuming they consist of a single js file).

    I just tried yours and it doesn't seem to work though - it's loading http://registry.npmjs.org/get-own-property-symbols/-/get-own-property-symbols-0.1.2.tgz but trying to find ./build/get-own-property-symbols.node.js and failing because the path is actually package/build/get-own-property-symbols.js.

    I haven't really done much work on NPM support, because most modules I looked at in NPM pulled in loads of dependencies and filled up the available memory - it could be that something has changed or I'm just not dealing with that particular case (the NPM loader's code is here)

    Another simple hack is just to stick the JS file's URL into require:

    require("https://raw.githubusercontent.com/WebReflection/get-own-property-symbols/master/src/get-own-property-symbols.js");
    

    You can use localhost and a server, or you can use the 'project' feature in the Web IDE so that you can pull single files directly off a directory on your hard disk.

About

Avatar for Gordon @Gordon started