Giter Site home page Giter Site logo

web-packing's Introduction

web-packing

Webpack on demand (immutable builds, cached by your browser)

Inspired by "Browserify as a service" at https://wzrd.in/.

Just deploy this micro service yourself (Zeit.co Now works really well). Then require single or multiple NPM packages.

Example

Let us say you want to try hyperx. Just grab it and it will be available as window.packs.hyper

<script src="https://your web-packing domain/hyperx"></script>
<script>
  // print virtual dom from template string
  var hyperx = window.packs.hyperx
  var write = hyperx(function (tagName, attrs, children) {
    console.log(tagName, attrs, children)
  })
  write`<h1>hello world</h1>`
</script>

Multiple libs can be packed

<script src="https://your web-packing domain/hyperx&lodash"></script>
<script>
  var {hyperx, lodash} = window.packs
</script>

See more examples in examples folder.

It is super slow, right?!

Running NPM install + webpack every time someone requires a library is slow. To get around it, every bundle is cached by the service and returned with the following header, which helps alleviate the problem

Cache-Control:max-age=99999999, public, immutable

You can see the server timings BTW in the modern browser

Server Timing

Small print

Author: Gleb Bahmutov [email protected] @ 2017

License: MIT - do anything with the code, but don't blame me if it does not work.

Support: if you find any problems with this module, email / tweet / open issue on Github

web-packing's People

Contributors

bahmutov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

coder698 daveek

web-packing's Issues

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.