This repository was archived by the owner on Jan 24, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -36,16 +36,16 @@ module.exports = function(content){
36
36
args . push ( options . proxy ) ;
37
37
}
38
38
39
+ this . addDependency ( resource ) ;
40
+ args . push ( resource ) ;
41
+
39
42
if ( options . args ) {
40
43
args = args . concat ( options . args ) ;
41
44
}
42
45
43
- this . addDependency ( resource ) ;
44
- args . push ( resource ) ;
45
-
46
46
let callback = this . async ( ) ;
47
47
let debug = options . debug ;
48
- let cmd = ' php ' + shellescape ( args ) ;
48
+ let cmd = ` php -r 'require $argv[1]; echo PHP_EOL, json_encode(get_included_files());' ${ shellescape ( args ) } ` ;
49
49
async function runPhp ( ) {
50
50
if ( debug ) {
51
51
console . log ( cmd ) ;
@@ -61,6 +61,15 @@ module.exports = function(content){
61
61
callback ( stderr ) ;
62
62
}
63
63
else {
64
+ // Split out last line which contains list of included files and add them as Webpack dependencies
65
+ const includedSeparator = stdout . lastIndexOf ( '\n' ) ;
66
+ const dependencies = stdout . slice ( includedSeparator ) ;
67
+ stdout = stdout . slice ( 0 , includedSeparator ) ;
68
+
69
+ JSON . parse ( dependencies ) . forEach ( function ( dependency ) {
70
+ self . addDependency ( dependency )
71
+ } ) ;
72
+
64
73
callback ( null , stdout ) ;
65
74
}
66
75
You can’t perform that action at this time.
0 commit comments