Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    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
    Evan Hackett
    does browserify not support es6 arrow functions by default? I'm getting an unexpected token arrow
    Evan Hackett
    nvm, I think I had bad syntax. Either way I added the babeilify transform
    Rye Terrell
    anyone else having issues with the async keyword not being parsed when browserify-ing?
    Ricky Reusser
    is there a way to override the path of a specific require without simply linking to an external bundle?
    like I'd love to simply ask it to resolve require('my-project') to /local/path/to/my-project
    I'm packaging an npm module with browserify. But it only works if I turn on uglification. If I don't then, when I import that module into my app and pack the main app (again with browserify), that second pack fails to find the dependencies that the npm module has (e.g.ERROR: Cannot find module './modules/es6.string.fontsize' )
    the npm module is packed with browserify. None of its require statements should be followed by the second browserify.

    browserify is still awesome.

    I was making a card for my dad for fathers day, in code of course, & since I spent a fair bit the time on the card, I didn't have any to waste on a build system.

    browserify -t [ browserify-css --autoInject=true ] --entry js/main.js -o index.browserified.js

    index file with all the codes, full of the win.

    Hi, is anyone know how to use browserify in grunt so that "require" keyword can work ?
    Jonas Amundsen
    Has anyone successfully used browserify together with yarn2 and pnp?