Skip to content

Commit

Permalink
Merge pull request #1801 from browserify/resolve-initial-link
Browse files Browse the repository at this point in the history
Always resolve initial link
  • Loading branch information
goto-bus-stop committed Feb 7, 2018
2 parents 2b9b319 + 59e4642 commit 2fc049e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -503,7 +503,7 @@ Browserify.prototype._createDeps = function (opts) {
}
if (err) cb(err, file, pkg)
else if (file) {
if (opts.preserveSymlinks && parent) {
if (opts.preserveSymlinks && parent.id !== self._mdeps.top.id) {
return cb(err, path.resolve(file), pkg, file)
}

Expand Down
12 changes: 12 additions & 0 deletions test/preserve-symlinks.js
Expand Up @@ -13,3 +13,15 @@ test('optionally preserves symlinks', function (t) {
vm.runInNewContext(src, {});
});
});

test('always resolve entry point symlink', function (t) {
t.plan(2);

var b = browserify(__dirname + '/preserve_symlinks/linked-entry.js', {preserveSymlinks: true});
b.bundle(function (err, buf) {
t.ok(!err);
t.ok(buf);
var src = buf.toString('utf8');
vm.runInNewContext(src, {});
});
})
1 change: 1 addition & 0 deletions test/preserve_symlinks/linked-entry.js

0 comments on commit 2fc049e

Please sign in to comment.