Closed ehynds closed 8 years ago
Thanks @ehynds!
If you can make that one change @ehynds, I'll merge this. Thank you!
all set, @joeybaker
Thanks @ehynds
Released as 2.1.0
Fair warning to rendr users. When you expose ./app/views/default/index.js
to both app/view/default
AND app/view/default/index
in two separate b.require()
calls, browserify seems to only acknowledge the first require call it gets for a particular file. It is unclear if this is a bug in browserify, or if it is intended behavior.
This breaks functionality for rendr. I can work around this when handling the remapify:files event. If the expanded alias does not contain index.js
OR the key contains index
, I pass it into b.require()
. Combining this logic with my logic for ensuring that it only requires the file when it does not contain .js
and when there are no backslashes in the key, this is my final event handler:
b.on("remapify:files", function(file, expandedAliases) {
Object.keys(expandedAliases).forEach(function(key) {
if (key.indexOf(".js") === -1 && key.indexOf("\\") === -1 && (expandedAliases[key].indexOf("index.js") === -1 || key.indexOf("index") !== -1)) {
b.require(path.resolve(expandedAliases[key]), {expose: key});
}
});
});
Obviously, this is messy. I'd rather not have to do this. If anyone knows a way around this, I'm open to suggestions.
Fixes #20