Skip to content

Commit 084d058

Browse files
author
benholloway
committed
fixed require() thinking adjacent file paths were to a bower component
1 parent cb43f05 commit 084d058

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/build/browserify.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ function compile(bannerWidth, transforms) {
137137

138138
// bower project
139139
} else {
140-
var directory = path.resolve(path.join(BOWER, path.dirname(original)));
141-
var isFound = fs.existsSync(directory) && fs.statSync(directory).isDirectory();
140+
var partial = path.dirname(original);
141+
var directory = (partial !== '.') && path.resolve(path.join(BOWER, partial));
142+
var isFound = directory && fs.existsSync(directory) && fs.statSync(directory).isDirectory();
142143
if (isFound) {
143144
transformed = slash(path.resolve(path.join(BOWER, original))); // path is within the bower directory
144145
}
@@ -197,7 +198,7 @@ function compile(bannerWidth, transforms) {
197198
return (new RegExp('[\'"]' + analysis[1] + '[\'"]')).test(fileText);
198199
})
199200
.shift();
200-
message = path.join(analysis[2], filename) + ':0:0: ' + analysis[1] + '\n';
201+
message = path.join(analysis[2], filename) + ':0:0: Cannot find import ' + analysis[1] + '\n';
201202

202203
// Unknown
203204
} else {

0 commit comments

Comments
 (0)