File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,28 @@ function addPackages(siteConfig, buildFolder) {
112
112
113
113
return readFile ( path . join ( fullBuildFolderPath , "package.json" ) ) . then ( function ( packageContents ) {
114
114
var json = JSON . parse ( packageContents ) ;
115
+ var filePathedDeps = siteConfig . html . dependencies ;
116
+
117
+ for ( var depName in siteConfig . html . dependencies ) {
118
+ var possibleFilePath = siteConfig . dependencies [ depName ] ;
119
+
120
+ if ( _ . startsWith ( possibleFilePath , 'file:' ) ) {
121
+ try {
122
+ var absDir = path . resolve ( possibleFilePath . substr ( 5 ) ) ;
123
+ if ( fs . statSync ( absDir ) . isDirectory ( ) ) {
124
+ filePathedDeps [ depName ] = absDir ;
125
+ }
126
+ } catch ( err ) {
127
+ // skip bad path
128
+ }
129
+ }
130
+ }
115
131
116
- json . dependencies = _ . assign ( json . dependencies || { } , siteConfig . html . dependencies ) ;
132
+ json . dependencies = _ . assign ( json . dependencies || { } , filePathedDeps ) ;
117
133
118
134
return writeFile ( path . join ( fullBuildFolderPath , "package.json" ) , JSON . stringify ( json ) ) . then ( function ( ) {
119
135
120
- var deps = _ . map ( siteConfig . html . dependencies , function ( version , packageName ) {
136
+ var deps = _ . map ( filePathedDeps , function ( version , packageName ) {
121
137
return '"' + packageName + '": callIfFunction( require("' + packageName + '") )' ;
122
138
} ) ;
123
139
You can’t perform that action at this time.
0 commit comments