Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Config option to change the default "node_modules" dirname
Summary: tldr: [Webpack has something similar to this option](https://webpack.github.io/docs/configuration.html#resolve-modulesdirectories) and some users find it useful. This is a feature request from here: #915 Reviewed By: @gabelevi Differential Revision: D2532941 fb-gh-sync-id: a7ae5f278345849b344863a68ecbc2baabc026d6
- Loading branch information
Showing
12 changed files
with
78 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[options] | ||
module.system.node.resolve_dirname=node_modules | ||
module.system.node.resolve_dirname=custom_resolve_dir |
10 changes: 10 additions & 0 deletions
10
...s/config_module_system_node_resolve_dirname/config_module_system_node_resolve_dirname.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
subdir/sublevel.js:5:2,5: string literal `subdir/custom_resolve_dir/testproj2` | ||
Expected string literal `node_modules/testproj2`, got `subdir/custom_resolve_dir/testproj2` instead | ||
subdir/sublevel.js:5:8,31: string literal `node_modules/testproj2` | ||
|
||
toplevel.js:6:2,5: string literal `node_modules/testproj` | ||
Expected string literal `custom_resolve_dir/testproj`, got `node_modules/testproj` instead | ||
toplevel.js:6:8,36: string literal `custom_resolve_dir/testproj` | ||
|
||
Found 2 errors |
3 changes: 3 additions & 0 deletions
3
tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// @flow | ||
|
||
export var name: "otherdir/testproj" = "otherdir/testproj"; |
3 changes: 3 additions & 0 deletions
3
tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// @flow | ||
|
||
export var name: "otherdir/testproj2" = "otherdir/testproj2"; |
3 changes: 3 additions & 0 deletions
3
tests/config_module_system_node_resolve_dirname/node_modules/testproj/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
tests/config_module_system_node_resolve_dirname/node_modules/testproj2/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
tests/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// @flow | ||
|
||
export var name: "subdir/custom_resolve_dir/testproj2" = "subdir/custom_resolve_dir/testproj2"; |
6 changes: 6 additions & 0 deletions
6
tests/config_module_system_node_resolve_dirname/subdir/sublevel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @flow | ||
|
||
import {name} from "testproj2"; | ||
|
||
(name: "node_modules/testproj2"); // Error: Resolve from sibling 'custom_resolve_dir' first! | ||
(name: "subdir/custom_resolve_dir/testproj2"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @flow | ||
|
||
import {name} from "testproj"; | ||
|
||
(name: "node_modules/testproj"); | ||
(name: "custom_resolve_dir/testproj"); // Error: Resolve from node_modules first! |