question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browserify Support

See original GitHub issue

I’m trying to figure out how to bundle the browser version when requiring and bundling asap from another module. It seems that simply require("asap") bundles the node version in the browserify bundle.

I might be missing something trivial, if so, please let me know.

Edit:

It also works if I modify package.json in asap to qualify the browser*js files in the browser section. This seems to be the better option as it requires no change to the package.json in the requiring module.

  "main": "./asap.js",
  "browser": {
    "./asap.js": "./browser-asap.js",
    "./raw.js": "./browser-raw.js",
    "test/domain": "./test/browser-domain.js"
  },

/Edit

It does seem to work if I do the following in package.json in my module that requires asap:

"browser": {
   "asap": "asap/browser-asap"
}

and also manually modifying browser-asap.js in the asap module to require browser-raw

var var rawAsap = require("./browser-raw");

Thanks.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
xdavecommented, Feb 20, 2017

I’m attempting to use https://github.com/Khan/aphrodite in a project that I’m building with https://github.com/fuse-box/fuse-box

The browser mapping doesn’t seem to work with fuse-box (it works for the entry point, but not the other internal modules, such as raw).

The only way I can make this work is by changing:

var rawAsap = require("./raw");

to

var rawAsap = require("./browser-raw");

in browser-asap.js.

0reactions
kriskowalcommented, Apr 12, 2015

@ewie I mean 2.0.2, which I forgot to push. Fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browserify
Browserify lets you require('modules') in the browser by bundling up all of your dependencies. Install Documentation · Source Code · Help + Articles...
Read more >
browserify/browserify: browser-side require() the node.js way
Use a node-style require() to organize your browser code and load modules installed by npm. browserify will recursively analyze all the require() calls...
Read more >
Lesson 3. Bundling modules with Browserify
How does Browserify help with ES6 modules? You learned in lesson 2 that Babel transpiles your ESNext code so you can execute it...
Read more >
Browserify Tutorial - Using require() In The Browser - YouTube
... modules in the front-end part of your web application (in the browser) with the help of a very powerful tool called Browserify....
Read more >
Getting Started with Browserify - SitePoint
Browserify allows us to use node.js style modules in the browser. We define dependencies and then Browserify bundles it all up into a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found