Skip to content

Commit

Permalink
Avoid back referencing to fix browserify issue
Browse files Browse the repository at this point in the history
Apparently Browserify won't understand if you're referencing back to the
npm main file unless you reference it in browserify require as a
relative path to it, i.e. like this:

    browserify()
        .require("./node_modules/reflux/src/index.js", { expose: 'reflux'})

Added another index file at root level that imports the previous index
file and changed references to reference "./index" instead of "../src".

Fixes #129
Closes #138
  • Loading branch information
spoike committed Jan 3, 2015
1 parent 169d276 commit e498c99
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 21 deletions.
24 changes: 12 additions & 12 deletions dist/reflux.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ module.exports = function(store, definition) {
};

},{}],9:[function(_dereq_,module,exports){
var Reflux = _dereq_('../src'),
var Reflux = _dereq_('./index'),
_ = _dereq_('./utils');

module.exports = function(listenable,key){
Expand All @@ -537,9 +537,9 @@ module.exports = function(listenable,key){
};
};

},{"../src":12,"./utils":16}],10:[function(_dereq_,module,exports){
},{"./index":12,"./utils":16}],10:[function(_dereq_,module,exports){
var _ = _dereq_('./utils'),
Reflux = _dereq_('../src'),
Reflux = _dereq_('./index'),
Keep = _dereq_('./Keep'),
allowed = {preEmit:1,shouldEmit:1};

Expand Down Expand Up @@ -588,9 +588,9 @@ module.exports = function(definition) {

};

},{"../src":12,"./Keep":3,"./utils":16}],11:[function(_dereq_,module,exports){
},{"./Keep":3,"./index":12,"./utils":16}],11:[function(_dereq_,module,exports){
var _ = _dereq_('./utils'),
Reflux = _dereq_('../src'),
Reflux = _dereq_('./index'),
Keep = _dereq_('./Keep'),
allowed = {preEmit:1,shouldEmit:1},
bindMethods = _dereq_('./bindMethods');
Expand All @@ -609,15 +609,15 @@ module.exports = function(definition) {

for(var a in Reflux.StoreMethods){
if (!allowed[a] && (Reflux.PublisherMethods[a] || Reflux.ListenerMethods[a])){
throw new Error("Cannot override API method " + a +
throw new Error("Cannot override API method " + a +
" in Reflux.StoreMethods. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead."
);
}
}

for(var d in definition){
if (!allowed[d] && (Reflux.PublisherMethods[d] || Reflux.ListenerMethods[d])){
throw new Error("Cannot override API method " + d +
throw new Error("Cannot override API method " + d +
" in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead."
);
}
Expand Down Expand Up @@ -648,7 +648,7 @@ module.exports = function(definition) {
return store;
};

},{"../src":12,"./Keep":3,"./bindMethods":8,"./utils":16}],12:[function(_dereq_,module,exports){
},{"./Keep":3,"./bindMethods":8,"./index":12,"./utils":16}],12:[function(_dereq_,module,exports){
exports.ActionMethods = _dereq_('./ActionMethods');

exports.ListenerMethods = _dereq_('./ListenerMethods');
Expand Down Expand Up @@ -836,7 +836,7 @@ function emitIfAllListenablesEmitted(join) {
}

},{"./createStore":11,"./utils":16}],14:[function(_dereq_,module,exports){
var Reflux = _dereq_('../src');
var Reflux = _dereq_('./index');


/**
Expand Down Expand Up @@ -873,8 +873,8 @@ module.exports = function(listenable,callback,initial){
};
};

},{"../src":12}],15:[function(_dereq_,module,exports){
var Reflux = _dereq_('../src');
},{"./index":12}],15:[function(_dereq_,module,exports){
var Reflux = _dereq_('./index');

/**
* A mixin factory for a React component. Meant as a more convenient way of using the `listenerMixin`,
Expand Down Expand Up @@ -908,7 +908,7 @@ module.exports = function(listenables){
};
};

},{"../src":12}],16:[function(_dereq_,module,exports){
},{"./index":12}],16:[function(_dereq_,module,exports){
/*
* isObject, extend, isFunction, isArguments are taken from undescore/lodash in
* order to remove the dependency
Expand Down
2 changes: 1 addition & 1 deletion dist/reflux.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./src');
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "reflux",
"version": "0.2.1",
"description": "A simple library for uni-directional dataflow application architecture inspired by ReactJS Flux",
"main": "src/index.js",
"main": "index.js",
"scripts": {
"test": "grunt test",
"benchmark": "node test/benchmarks"
Expand Down
2 changes: 1 addition & 1 deletion src/connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Reflux = require('../src'),
var Reflux = require('./index'),
_ = require('./utils');

module.exports = function(listenable,key){
Expand Down
2 changes: 1 addition & 1 deletion src/createAction.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var _ = require('./utils'),
Reflux = require('../src'),
Reflux = require('./index'),
Keep = require('./Keep'),
allowed = {preEmit:1,shouldEmit:1};

Expand Down
6 changes: 3 additions & 3 deletions src/createStore.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var _ = require('./utils'),
Reflux = require('../src'),
Reflux = require('./index'),
Keep = require('./Keep'),
allowed = {preEmit:1,shouldEmit:1},
bindMethods = require('./bindMethods');
Expand All @@ -18,15 +18,15 @@ module.exports = function(definition) {

for(var a in Reflux.StoreMethods){
if (!allowed[a] && (Reflux.PublisherMethods[a] || Reflux.ListenerMethods[a])){
throw new Error("Cannot override API method " + a +
throw new Error("Cannot override API method " + a +
" in Reflux.StoreMethods. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead."
);
}
}

for(var d in definition){
if (!allowed[d] && (Reflux.PublisherMethods[d] || Reflux.ListenerMethods[d])){
throw new Error("Cannot override API method " + d +
throw new Error("Cannot override API method " + d +
" in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead."
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/listenTo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Reflux = require('../src');
var Reflux = require('./index');


/**
Expand Down
2 changes: 1 addition & 1 deletion src/listenToMany.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Reflux = require('../src');
var Reflux = require('./index');

/**
* A mixin factory for a React component. Meant as a more convenient way of using the `listenerMixin`,
Expand Down

0 comments on commit e498c99

Please sign in to comment.