Skip to content

Commit

Permalink
Don't resolve slash and tilde paths twice (#1993)
Browse files Browse the repository at this point in the history
Fix "Cannot resolve dependency" errors for valid slash and tilde paths.

Before:

    /src/js/index.js
      -> /home/user/my-project/src/js/index.js
      -> /home/user/my-project/home/user/my-project/src/js/index.js

Error:

    Cannot resolve dependency /home/user/my-project/src/js/index.js

After:

    /src/js/index.js
      -> /home/user/my-project/src/js/index.js

The code already has a way for asset-handlers to signal to the bundler that a dependency has been resolved to an absolute path, but it isn't being used.

fixes #1555
fixes #1986
  • Loading branch information
chocolateboy authored and DeMoorJasper committed Sep 6, 2018
1 parent 43685f2 commit 7ca56f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/parcel-bundler/src/Asset.js
Expand Up @@ -107,7 +107,7 @@ class Asset {
depName = './' + path.relative(path.dirname(this.name), resolved);
}

this.addDependency(depName, Object.assign({dynamic: true}, opts));
this.addDependency(depName, Object.assign({dynamic: true, resolved}, opts));

parsed.pathname = this.options.parser
.getAsset(resolved, this.options)
Expand Down

0 comments on commit 7ca56f9

Please sign in to comment.