Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always recreate paths for external modules (#2706)
* Always recreate paths for external modules * Make sure it is possible to both use the "paths" option and have other external dependencies
- Loading branch information
1 parent
b96f5bc
commit 0e4fe6f
Showing
5 changed files
with
55 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module.exports = { | ||
description: 'allows using the path option selectively', | ||
options: { | ||
external: ['dep-a', 'dep-b'], | ||
output: { | ||
paths: { | ||
'dep-a': 'secret-dep' | ||
} | ||
} | ||
}, | ||
context: { | ||
require(id) { | ||
if (id === 'secret-dep') { | ||
return 'secret'; | ||
} | ||
if (id === 'dep-b') { | ||
return 'b'; | ||
} | ||
throw new Error(`Unexpected dependency ${id}`); | ||
} | ||
} | ||
}; |
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,5 @@ | ||
import a from 'dep-a'; | ||
import b from 'dep-b'; | ||
|
||
assert.equal(a, 'secret'); | ||
assert.equal(b, 'b'); |
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