4 ms·
> When a module is required, we fetch it's javascript as a string using a synchronous XHR.
by sjs 16y ago
> When a module is required, we fetch it's javascript as a string using a synchronous XHR.
- scotth 16y agoRight. What need does this project meet? Sounds like a great way to create a lousy user experience.
- marcuswestin 16y agoThe synchronous XHR requests are only used in your development environment. For production, use `node browser-require/compile.js`, which will compile all your required javascript modules into a single file. It really doesn't make sense to asynchronously request all of your javascript files on production pages.
- slexaxton 16y agoActually it makes a ton of sense to asynchronously require javascript files on your production page. If you load them asynchronously and in parallel, you can often get much better performance than one single request (serially). http://blog.getify.com/2009/11/labjs-why-not-just-concat/ http://blog.getify.com/2009/11/labjs-why-not-just-concat/
- arthurschreiber 16y agoObviously, that's meant for development only and that's why it also ships with it's own compiler for production (where I seriously hope they don't use a synchronous XHR to fetch the compiled code).
- marcuswestin 16y agono, it does not :)