File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 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) {
112112
113113 return readFile ( path . join ( fullBuildFolderPath , "package.json" ) ) . then ( function ( packageContents ) {
114114 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+ }
115131
116- json . dependencies = _ . assign ( json . dependencies || { } , siteConfig . html . dependencies ) ;
132+ json . dependencies = _ . assign ( json . dependencies || { } , filePathedDeps ) ;
117133
118134 return writeFile ( path . join ( fullBuildFolderPath , "package.json" ) , JSON . stringify ( json ) ) . then ( function ( ) {
119135
120- var deps = _ . map ( siteConfig . html . dependencies , function ( version , packageName ) {
136+ var deps = _ . map ( filePathedDeps , function ( version , packageName ) {
121137 return '"' + packageName + '": callIfFunction( require("' + packageName + '") )' ;
122138 } ) ;
123139
You can’t perform that action at this time.
0 commit comments