UNPKG

j-gallery

Version:
97 lines (77 loc) 2.83 kB
[![npm][npm]][npm-url] [![deps][deps]][deps-url] [![chat][chat]][chat-url] <div align="center"> <!-- replace with accurate logo e.g from https://worldvectorlogo.com/ --> <a href="https://github.com/webpack/webpack"> <img width="200" height="200" vspace="" hspace="25" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg"> </a> <h1>Bundle Loader</h1> <p>Bundle loader for Webpack.<p> </div> <h2 align="center">Install</h2> ```bash npm i bundle-loader --save ``` <h2 align="center">Usage</h2> [Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html) ``` javascript // The chunk is requested, when you require the bundle var waitForChunk = require("bundle-loader!./file.js"); // To wait until the chunk is available (and get the exports) // you need to async wait for it. waitForChunk(function(file) { // use file like it was required with // var file = require("./file.js"); }); // wraps the require in a require.ensure block ``` The file is requested when you require the bundle loader. If you want it to request it lazy, use: ``` javascript var load = require("bundle-loader?lazy!./file.js"); // The chunk is not requested until you call the load function load(function(file) { }); ``` You may set name for bundle (`name` query parameter). See [documentation](https://github.com/webpack/loader-utils#interpolatename). ``` javascript require("bundle-loader?lazy&name=my-chunk!./file.js"); ``` <h2 align="center">Maintainers</h2> <table> <tbody> <tr> <td align="center"> <img width="150" height="150" src="https://avatars3.githubusercontent.com/u/166921?v=3&s=150"> </br> <a href="https://github.com/bebraw">Juho Vepsäläinen</a> </td> <td align="center"> <img width="150" height="150" src="https://avatars2.githubusercontent.com/u/8420490?v=3&s=150"> </br> <a href="https://github.com/d3viant0ne">Joshua Wiens</a> </td> <td align="center"> <img width="150" height="150" src="https://avatars3.githubusercontent.com/u/533616?v=3&s=150"> </br> <a href="https://github.com/SpaceK33z">Kees Kluskens</a> </td> <td align="center"> <img width="150" height="150" src="https://avatars3.githubusercontent.com/u/3408176?v=3&s=150"> </br> <a href="https://github.com/TheLarkInn">Sean Larkin</a> </td> </tr> <tbody> </table> [npm]: https://img.shields.io/npm/v/bundle-loader.svg [npm-url]: https://npmjs.com/package/bundle-loader [deps]: https://david-dm.org/webpack-contrib/bundle-loader.svg [deps-url]: https://david-dm.org/webpack-contrib/bundle-loader [chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg [chat-url]: https://gitter.im/webpack/webpack