3 ms·
Please don't rely on require hooks in libraries. They are kind of evil in applications already (because they amplify the "synchronous require" problem). Test yo
by jkrems 12y ago
Please don't rely on require hooks in libraries. They are kind of evil in applications already (because they amplify the "synchronous require" problem). Test your library against a version of 6to5, compile, publish, and remove that paragraph in font size 48 from your README.*
(*) I hope you add such a paragraph when your library relies on a global require hook that changes the default behavior of require for all .js files in all libraries.
- tlrobinson 12y agoWhat is 'the "synchronous require" problem'? I've never run into issues with the CoffeeScript require hook, for example.
- jkrems 12y agoWith a lot of files app startup can be delayed and the event loop be blocked. Which messes with timeouts among other things. The problem is that each file is loaded from disk and parsed in series without any level of parallelism (no real way around that in a pre-ES6 world). With CoffeeScript you put the time it takes to compile to JavaScript on top of that. If you have a big app with a lot of CoffeeScript files, it might be worth trying to compile them ahead-of-time instead. Though your mileage may vary in how much it changes.
- tlrobinson 12y agoI don't see that being an issue for the vast majority of Node.js programs, i.e. long-running servers.
- jdc0589 12y agodefine "issue". will it impede functionality? probably not. will it add precious time to server process start time? definitely, especially if the problem gets compounded.
- jkrems 12y agoAs I said: there's no guarantee it affects you. But messing with timeouts during startup (where stuff might be failing and prevent server processes from recovering correctly) can be an issue. Even when the process is long-running in general. If that issue affects your particular program is a different question.
- albertoleal 12y agoSee: https://github.com/sebmck/roadrunner https://github.com/sebmck/roadrunner