Skip to content
This repository was archived by the owner on Dec 4, 2022. It is now read-only.

resolve first according to the custom-resolve settings and fallback to the standard resolver #108

Merged
merged 2 commits into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]

## [2.0.12-dev.1] - 2019-07-15

- [#1779](https://github.com/teambit/bit/issues/1779) resolve first according to the custom-resolve settings and fallback to the standard resolver

## [2.0.12-angular.3] - 2019-06-14

- fix dependency resolution of `.` and `..` to not be identified as custom-resolved used.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bit-javascript",
"version": "2.0.12-angular.3",
"version": "2.0.12-dev.1",
"scripts": {
"flow": "flow; test $? -eq 0 -o $? -eq 2",
"lint": "eslint src && flow check || true",
Expand Down
19 changes: 12 additions & 7 deletions src/dependency-builder/filing-cabinet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,17 @@ function commonJSLookup(options: Options) {

let result = '';

if (!isRelativeImport(partial) && resolveConfig) {
debug(`trying to resolve using resolveConfig ${JSON.stringify(resolveConfig)}`);
result = resolveNonRelativePath(partial, filename, directory, resolveConfig);
if (result) {
debug('successfully resolved using resolveConfig');
options.wasCustomResolveUsed = true;
return result;
}
debug('failed resolved using resolveConfig, fall back to the standard resolver');
}

try {
result = resolve.sync(partial, {
extensions: resolveExtensions,
Expand All @@ -311,13 +322,7 @@ function commonJSLookup(options: Options) {
});
debug(`resolved path: ${result}`);
} catch (e) {
if (!isRelativeImport(partial) && resolveConfig) {
debug(`trying to resolve using resolveConfig ${JSON.stringify(resolveConfig)}`);
result = resolveNonRelativePath(partial, filename, directory, resolveConfig);
if (result) options.wasCustomResolveUsed = true;
} else {
debug(`could not resolve ${partial}`);
}
debug(`could not resolve ${partial}`);
}

return result;
Expand Down