GithubHelp home page GithubHelp logo

bpack-debug's Introduction

bpack-debug

A browserify helper to save the export value of a module for easier debugging.

It doesn't require changing your build - it works at runtime by simply requiring bpack-debug and running it. It scans the raw source of modules in the module cache for the alias name to export as a docblock directive.

Build Status

example

// in main.js
require('bpack-debug')(window);
/**
 * This is my my-module.js
 * @debugKey app.myModule
 */
module.exports = function(name) {
  console.log('hello ' + name);
}
// in the console
app.myModule('andres');
// hello andres

usage

bpackRequire(targetObj[, debugKey])

  • targetObj is the object to which you want to save the exported modules.
  • debugKey (optional) the docblock directive for the alias of the module. It can contain periods to denote a deep object.

targetObj.bpackDebug(alias)

bpack-debug lazily loads modules so it doesn't disturb the natural order of your dependency loading. However, if you need to access a module that hasn't been loaded yet, it can be forcefully loaded with this function.

caveats

  • bpack-debug is meant for development use only. The comment directives must exist for it to work. So if you minify the bundle, and remove the comments, it naturally won't work.
  • bpack-debug doesn't work across split bundles. Each bundle must load bpack-debug on its own.

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.