File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,27 @@ if (!ROOT_URL) {
41
41
webpack ( config , { webpack, dev, isServer } ) {
42
42
if ( dev ) config . devtool = "cheap-module-source-map" ;
43
43
44
+ const makeSafe = externals => {
45
+ if ( Array . isArray ( externals ) ) {
46
+ return externals . map ( ext => {
47
+ if ( typeof ext === "function" ) {
48
+ return ( context , request , callback ) => {
49
+ if ( / ^ @ a p p \/ / . test ( request ) ) {
50
+ callback ( ) ;
51
+ } else {
52
+ return ext ( context , request , callback ) ;
53
+ }
54
+ } ;
55
+ } else {
56
+ return ext ;
57
+ }
58
+ } ) ;
59
+ }
60
+ } ;
61
+
62
+ const externals =
63
+ isServer && dev ? makeSafe ( config . externals ) : config . externals ;
64
+
44
65
return {
45
66
...config ,
46
67
plugins : [
@@ -51,7 +72,7 @@ if (!ROOT_URL) {
51
72
} ) ,
52
73
] ,
53
74
externals : [
54
- ...( config . externals || [ ] ) ,
75
+ ...( externals || [ ] ) ,
55
76
isServer ? { "pg-native" : "pg/lib/client" } : null ,
56
77
] . filter ( _ => _ ) ,
57
78
} ;
You can’t perform that action at this time.
0 commit comments