Skip to content

browserify not working for node apps #696

@doapp-ryanp

Description

@doapp-ryanp

Trying to browserify my node code for use in lambda to help combat the cold start issues (which also raises the ceiling on the hard 50MB zipped limit).

Is browserfying for node not supported? Ultamately I'd like to just use the --node browserify option, but its not working.

Ex: (I wont be hard coding creds, this is just for ease of reproduce.)

var AWS = require('aws-sdk');
AWS.config.update({
  accessKeyId: 'mykey',
  secretAccessKey: 'mysecret'
});
var s3 = new AWS.S3();
s3.listBuckets(function(err, data) {
  console.log(err, data);
});

If I run browserify bundletests.js > bundled.js then run node bundle.js I get XMLHttpRequest is not defined which is expected since I'm not running in the browser.

So I run browserify bundletests.js --dg --no-builtins --no-commondir > bundled.js to not use the builtins and I get

module.js:340
    throw err;
          ^
Error: Cannot find module '_process'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at s (/Users/ryan/projects/JAWS/tests/bundle/testapp/myLambda/bundled.js:1:176)

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    closing-soonThis issue will automatically close in 4 days unless further comments are made.guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions