Socket
Socket
Sign inDemoInstall

wreq

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    wreq

node-style require()s in the browser without a compile step


Version published
Weekly downloads
2
Maintainers
1
Install size
254 kB
Created
Weekly downloads
 

Readme

Source

wreq

node-style require()s in the browser without a compile step

This module parses the dependency graph of modules at runtime and pre-fetches dependencies using asynchronous XMLHttp in parallel.

example usage

First write some node-style require()s:

js/beep.js:

module.exports = 'beepity'

js/boop.js:

module.exports = 'boop!!!'

js/entry.js:

var beep = require('./beep.js');
var boop = require('./boop.js');

var elem = document.getElementById('res');
elem.innerHTML = beep + ' ' + boop;

Now load up "/wreq.js" and "/js/entry.js" in some script tags. The files that you want to load with wreq should be type="text/wreq". You can get wreq.js from this repository in the root directory.

<script src="/wreq.js"></script>
<script src="/js/entry.js" type="text/wreq"></script>

<div id="res">[]</div>

Now load index.html. That's it, no compile step and you get node-style so-called "synchronous" require()s.

Now let's all stop making those ridiculous arguments that node-style require()s necessarily entail synchronous XHR or a server-side build step or other silliness.

install

Copy wreq.js or wreq.min.js into your project. All done.

license

MIT/X11

Keywords

FAQs

Last updated on 07 May 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc