Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    hola @sandeepl337
    Hi Charles
    Risto Stevcev
    does anyone know if browserify-shim will understand dependencies that are node shimmed?
      "main": "./js/entry.js",
      "browser": {
        "jquery": "./js/vendor/jquery.js"
      "browserify-shim": {
        "jquery": "$",
        "three": "global:THREE"
      "browserify": {
        "transform": [ "browserify-shim" ]
      "dependencies": {
        "browserify-shim": "~3.2.0"
    in this (their main example), it's fetching jquery from the a js file the user maintains. I'd rather just use the browserified module and install and maintain it via npm install jquery
    but I don't know if this would work:
        "jquery-ui": {
          "depends": [
    Risto Stevcev
    I only needed to worry about jquery plugins
    Daniel Moore
    Is it better for plugin authors to push to b.pipeline or b.pipeline.get('wrap')? See: https://github.com/zoubin/factor-vinylify/pull/1#discussion_r63813785
    Alex J Burke
    Hi folks - I wonder if you could help me? I have been trying to build a bundle where a particular core module is swapped out for something else i.e. I need require('net') to return something particular after bundling. There is documentation that alludes to this being possible, but I honestly can't understand what incantation to use. I'd greatly appreciate any hints. Thanks.
    Hello, does anyone know why the process.env.NODE_ENV is undefined when browserify react with babelify transform.
    hello everyone. is there an easy way to browserify a directory of files into another directory with each soruce file being it's own destination file
    i have al ad of config files that i want to keep separate
    Matt McFarland
    If I'm understanding your problem correctly, you may be able to solve it using bulkify: https://www.npmjs.com/package/bulkify
    Bob Eagan
    Hi all, I'm trying to require some .md (markdown) files in a javascript file but not having much luck. I've installed stringify and added the transform to my gulp task but still getting a syntax error for unexpected # (which is a header in the first markdown file it is trying to require)
    any tips on where I should be looking to sort this out would be much appreciated
    David Marr
    if i wanted to bring in a module that required react, but not bundle react, whats the best approach there?
    David Marr
    or put another way:
    do you know how to have browserify not bundle in react
    and basically use the globally available version React whenever require('react') is called?
    David Marr
    but i am still seeing react bundled in
    do I need to do some manual shimming with module.exports = React or something?
    i basically want to use script tags to include react and react-dom and then have my module just use those shims
    David Marr
    put together a repo illustrating this https://github.com/marr/app
    David Marr
    having lots of trouble with browserify-shim
    i have a umd module that i'm trying to browserify
    its not changing the modules require('foo') to global['Foo']
    even though my package.json specifies browserify-shim: { 'foo': 'global:Foo' }
    do i need to target that module somehow? like browserify-shim: { 'mod': { depends: "foo" }}
    Nils Magnus Djupvik
    Hi! I'm doing a transition from using bower to rely on npm (npm scripts) only for building and bundling our apps. I'm almost there, but I struggle with images in dependant modules (in node_modules). I've tried parcelify, rework etc for the css. The css bundle is fine, but I need the images in my bundled app.
    If only there was plugin for making base64 replacement for urls in the css when bundling
    Laszlo Korte

    Hi, I am working on a pretty simple project using React with babel and browserify. I am struggling to get proper minification/uglification working.

    I already tried using minifyify and uglifyify. But there are still a lot of line breaks in the final file and overall the result seems still to large.(~300-400kb)

    When using minifyify and then apply to uglifyjs2 to the output the file size goes down to ~200kb.

    But it feels pretty redundant and does not work with watchify.

    So I guess my question is: When using babel/browserify/watchify via cli, what's the best and simplest way to do minification?

    currently my build command is:
    NODE_ENV=production browserify src/main.js -t babelify -g envify -v -p bundle-collapser/plugin -p [minifyify --no-map --uglify [ --compress [ --dead_code ] --mangle ] ] | uglifyjs -m -e -c dead_code,screw-ie8,warnings=false > build/bundle.js

    But passing all the uglify options twice feels wrong.

    I would like it to look more like:

    watchify src/main.js -t babelify -g envify -p uglify -o build/bundle.js -v
    Laszlo Korte
    Eli White
    Is there any way to profile the time spent in different transforms? My karma test suite's browserify bundle takes 4.5 minutes to compile
    Terin Stock
    @TheSavior that's not a current feature, nor do i think it's been suggested before
    Eli White
    @terinjokes Hmm. kk. In the mean time, do you have any recommendations for looking into this that might require a bit more mucking? I’m curious if browserify is slow because of babelify on our codebase, or just because there are purely a lot of files it has to process, or because it is pulling in really large packages like react. I have no idea how to track down where it is spending it’s time.
    I used chrome’s dev tools to create some flame charts of the node process, but it didn’t seem to help point me in the right direction
    Terin Stock
    i was going to suggest making some flame charts
    Eli White
    @terinjokes Flame charts appear to tell me is that it was spending a lot of time reading files but I couldn’t figure out what files or what part of the stack it was. Whether it was node requiring files, or loading up babel’s deps, or something else. It sounds like you don’t have any magic bullets or grand suggesstions though and that I should keep digging
    Terin Stock
    @TheSavior I do not. Our main website build takes > 30 seconds. I've looked into it from time to time, but have no magic bullet.
    Risto Stevcev
    how do I debug this issue? I can't figure out at all what I'm doing wrong here
    gulp.task('js:compile', function() {
      return browserify([ deployDir + '/js/pages/newModelVisualization.js'
                        ], { debug: true })
        .transform(babelify,{presets: [__dirname + "/node_modules/babel-preset-es2015-nostrict"]})
    I get an error like this:
          throw er; // Unhandled 'error' event
    Error: Cannot find module 'underscore' from '/home/velvet/tf/src-docroot/js/lib'
        at /home/velvet/tf/frontend/node_modules/resolve/lib/async.js:46:17
        at process (/home/velvet/tf/frontend/node_modules/resolve/lib/async.js:173:43)
        at ondir (/home/velvet/tf/frontend/node_modules/resolve/lib/async.js:188:17)
        at load (/home/velvet/tf/frontend/node_modules/resolve/lib/async.js:69:43)
        at onex (/home/velvet/tf/frontend/node_modules/resolve/lib/async.js:92:31)
        at /home/velvet/tf/frontend/node_modules/resolve/lib/async.js:22:47
        at FSReqWrap.oncomplete (fs.js:123:15)
    but it exists in that folder. I'm importing it as a relative path like import { _ } from './lib/underscore.js'
    and when I run flow it doesn't complain that the module doesn't exist
    what am I doing wrong? did I configure this wrong? how can I get browserify to at least tell me which file is giving it the error?
    Risto Stevcev
    nvm found the issue. I just wish this was a better error