Giter Club home page Giter Club logo

Comments (4)

capaj avatar capaj commented on July 22, 2024

@m-a-r-c-e-l-i-n-o this is a bug caused by the fact that I forgot to take into consideration the fact that some people might not have their package.json found when I wrote this line:

I have fixed that in release 0.5.1 by disabling this socket.io handler if pjson doesn't exist.

from chokidar-socket-emitter.

m-a-r-c-e-l-i-n-o avatar m-a-r-c-e-l-i-n-o commented on July 22, 2024

Thank you for the quick response. Have you considered that by resolving it that way, you are stripping the "Programatic" version of this feature: https://github.com/capaj/systemjs-hot-reloader/blob/master/hot-reloader.js#L58 ? The require for the "Programatic" will always fail, so it's more of a "require vs failure to require" issue than a "package.json vs no package.json" issue. Is there really no way to get that require working properly for both the "CLI" and "Programatic" versions?

from chokidar-socket-emitter.

capaj avatar capaj commented on July 22, 2024

@m-a-r-c-e-l-i-n-o programmatic will only fail when it can't find package.json. You're right that we could improve on that. Locating package.json is not very clever. I will take a look into improving that and I will also add a warning when we don't have package.json required succesfully.

from chokidar-socket-emitter.

m-a-r-c-e-l-i-n-o avatar m-a-r-c-e-l-i-n-o commented on July 22, 2024

Sorry, I don't think I explained myself well enough. My main concern is with the "Programmatic" version when being ran by jspm (i.e. jspm run my-node-server-file.js). When running the "Programmatic" version via plain ol' node/npm (i.e. node my-node-server-file.js), everything behaves as expected. It's true that for the "node my-node-server-file.js - Programmatic" we can do a little bit of a better job finding the JSON (since it's path starts at the script's location), but that can easily be resolved by passing the appropriate "dir" parameter. The real issue is that when doing jspm run my-node-server-file.js, even with the correct "dir" parameter, the require fails. It fails every time for anything outside the "jspm_packages/npm/chokidar-socket-emitter" directory, so my "package.json" located at the root of my project, will never be required. Seems like there is an inconsistency with the way jspm treats require functions that would need to be accounted for. Not sure if it's a jspm bug, or if there is a proper way of handling these cases that I'm not aware of. Does this help clarify my concern?

from chokidar-socket-emitter.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.