TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Browser-require.js brings "require" to the browser (just like node)

17 pointsby marcuswestinover 14 years ago
Browser-require lets you write javascript using "require", "exports" and "module" in the browser, just as you would in node. It helps you with your dependency management, and provides a compiler to condense all your required modules into a single file for production.

4 comments

juliusover 14 years ago
It uses synchronous XHR to load the JS-File. Then evals the JS-String.<p>This is great, but I could not figure out debugging my loaded code with this solution.<p>Any ideas ?
评论 #2162917 未加载
arthurschreiberover 14 years ago
The main difference between this and other solutions like RequireJS is the fact that you don't have to wrap your CommonJS modules in callbacks and thus could in theory use them "unmodified".
评论 #2161831 未加载
geuisover 14 years ago
I don't understand. Require.js <i>already</i> works in the browser. <a href="http://requirejs.org/" rel="nofollow">http://requirejs.org/</a>
评论 #2161817 未加载
sjsover 14 years ago
&#62; When a module is required, we fetch it's javascript as a string using a synchronous XHR.
评论 #2161826 未加载
评论 #2161773 未加载