-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathREAME.splittable
37 lines (32 loc) · 1.58 KB
/
REAME.splittable
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Compiled from https://github.com/google/closure-compiler
at b11c9970d87579ae50cee7dcda771ac726c71867
Reasons to use custom release:
- Turned off property renaming in ADVANCED mode. Otherwise React plugins break.
- Need c4a104075d40dd2191b45de33d00b79edd45b97e
- Applied small patch to fix https://github.com/google/closure-compiler/issues/2170
- Fixed NPE in CommonJS rewrite path.
## Work remote
https://github.com/google/closure-compiler/pull/2190/files
```
diff --git a/src/com/google/javascript/jscomp/deps/ModuleLoader.java b/src/com/google/javascript/jscomp/deps/ModuleLoader.java
index 46cdaa6..910e619 100644
--- a/src/com/google/javascript/jscomp/deps/ModuleLoader.java
+++ b/src/com/google/javascript/jscomp/deps/ModuleLoader.java
@@ -368,10 +368,14 @@ public final class ModuleLoader {
// /foo/ -> bar/node_modules/baz/foo_bar_baz.js
// /foo/node_modules/bar/ -> baz/foo_bar_baz.js
for (String modulePath : modulePaths) {
- String[] nodeModulesDirs = modulePath.split("/node_modules/");
+ String splitPath = modulePath;
+ if (modulePath.startsWith("node_modules/")) {
+ splitPath = "/" + modulePath;
+ }
+ String[] nodeModulesDirs = splitPath.split("/node_modules/");
String parentPath = "";
for (int i = 0; i < nodeModulesDirs.length - 1; i++) {
- if (i + 1 < nodeModulesDirs.length) {
+ if (i + 1 < nodeModulesDirs.length && !nodeModulesDirs[i].equals("")) {
parentPath += nodeModulesDirs[i] + "/";
}
String subPath = modulePath.substring(parentPath.length() + "node_modules/".length());
```