thlorenz / browserify-shim

📩 Makes CommonJS incompatible files browserifyable.
MIT License
934 stars 87 forks source link

Calling two functions in the same javascript file #228

Closed juanpabloaj closed 7 years ago

juanpabloaj commented 7 years ago

If I have this javascript file

// hello.js
var hello = function () {
  return 'hello';
};

var bye = function () {
  return 'bye bye';
};

I can use hello() with this configuration

"browserify": {
    "transform": ["browserify-shim"]
  },
  "browser": {
    "hello": "./hello.js"
  },
  "browserify-shim": {
    "hello": {"exports": "hello"}
  }

And call with

var hello = require('hello');
hello()

How can I use the both functions bye() and hello() ?

bendrucker commented 7 years ago

browserify-shim is only capable of handling one export per module so at the moment it cannot accomplish what you're requesting.