So.. What's up with enyojs 2.6?



  • edited January 2016
    If it is a require-able module, then you can require it directly into your project via relative path from the file requiring it
    So, this doesn't seem to work if that require-able module also has its own require-able modules underneath it (recursive node_modules directories). My specific example is firebase. Attempting to require("./node_modules/firebase") throws an error for not being able to locate faye-websocket module.

    I have tried a bunch of different ways to specify in headScripts, but it is still eluding me as I never see the script I specify loaded in HEAD or in the sources of my inspector.
  • edited January 2016
    You likely won't be able to drop in a node.js module into enyo and have it work as is. Although it's using a familiar syntax, the loader isn't the same. In the case of firebase, I think headScripts is the right solution when used with their packed web source @ Doesn't appear that headScripts allows a URI at this point so you'll have to download it to your project.

    enyo pack --headScripts=firebase.js
  • I think if you add node_modules to your "paths" it will work, @theryanjduffy but I haven't tested that in quite a while.
  • @clinuz I just tried it and it seems to behave similarly in that it will find a top-level node module like that (I don't have to specify the path to node_modules), but if it is requiring its own node modules, it bombs.

    I keep looking for an easy way to tell my enyo package I need firebase and then have it also work with the packager. When it was using bower for package inclusion, it worked well.
  • I'm guessing the module lookup *within* firebase is the issue. Adding node_modules to paths will allow you to call require('firebase') but if firebase calls require('faye-websocket') it won't resolve.
  • Right, exactly that. If I had tried it with a simpler module that required nothing else, I would have been successful and later down the road been flummoxed if I added a more complex one.

    We are using require and writing apps that look like node modules and it made sense to me I should be able to require other node modules, but if we aren't going to support it I will need to look into another way to accomplish it.
  • FYI: See the 2.7 public release announcement in the forums here.
Sign In or Register to comment.