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

Commit 59999fa

Browse files
authored
resolve first according to the custom-resolve settings and fallback to the standard resolver (#108)
* fix teambit/bit#1779, resolve first according to the custom-resolve settings and fallback to the standard resolver * change version from angular to dev
1 parent aee2d36 commit 59999fa

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [unreleased]
99

10+
## [2.0.12-dev.1] - 2019-07-15
11+
12+
- [#1779](https://github.com/teambit/bit/issues/1779) resolve first according to the custom-resolve settings and fallback to the standard resolver
13+
1014
## [2.0.12-angular.3] - 2019-06-14
1115

1216
- fix dependency resolution of `.` and `..` to not be identified as custom-resolved used.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bit-javascript",
3-
"version": "2.0.12-angular.3",
3+
"version": "2.0.12-dev.1",
44
"scripts": {
55
"flow": "flow; test $? -eq 0 -o $? -eq 2",
66
"lint": "eslint src && flow check || true",

src/dependency-builder/filing-cabinet/index.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,17 @@ function commonJSLookup(options: Options) {
303303

304304
let result = '';
305305

306+
if (!isRelativeImport(partial) && resolveConfig) {
307+
debug(`trying to resolve using resolveConfig ${JSON.stringify(resolveConfig)}`);
308+
result = resolveNonRelativePath(partial, filename, directory, resolveConfig);
309+
if (result) {
310+
debug('successfully resolved using resolveConfig');
311+
options.wasCustomResolveUsed = true;
312+
return result;
313+
}
314+
debug('failed resolved using resolveConfig, fall back to the standard resolver');
315+
}
316+
306317
try {
307318
result = resolve.sync(partial, {
308319
extensions: resolveExtensions,
@@ -311,13 +322,7 @@ function commonJSLookup(options: Options) {
311322
});
312323
debug(`resolved path: ${result}`);
313324
} catch (e) {
314-
if (!isRelativeImport(partial) && resolveConfig) {
315-
debug(`trying to resolve using resolveConfig ${JSON.stringify(resolveConfig)}`);
316-
result = resolveNonRelativePath(partial, filename, directory, resolveConfig);
317-
if (result) options.wasCustomResolveUsed = true;
318-
} else {
319-
debug(`could not resolve ${partial}`);
320-
}
325+
debug(`could not resolve ${partial}`);
321326
}
322327

323328
return result;

0 commit comments

Comments
 (0)