-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add strip_prefix attr to js_library (#2519)
- Loading branch information
Showing
5 changed files
with
54 additions
and
1 deletion.
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,17 @@ | ||
load("//:index.bzl", "js_library", "nodejs_test") | ||
|
||
js_library( | ||
name = "stripped_library", | ||
package_name = "stripped_library", | ||
srcs = ["library/file.js"], | ||
strip_prefix = "library", | ||
) | ||
|
||
nodejs_test( | ||
name = "test", | ||
data = [ | ||
"test.js", | ||
":stripped_library", | ||
], | ||
entry_point = "test.js", | ||
) |
Empty file.
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,9 @@ | ||
// Try to load on unstripped path, this should fail | ||
try { | ||
require("stripped_library/library/file"); | ||
} catch (exc) { | ||
if (exc.code !== 'MODULE_NOT_FOUND') throw exc; | ||
} | ||
|
||
// Load with the stripped path, this should succeed | ||
require("stripped_library/file"); |