@@ -29,7 +29,7 @@ const blockEntryPaths = glob
29
29
const entryKey = filePath
30
30
. replace ( './assets/blocks/' , '' )
31
31
. replace ( '/index.js' , '' ) ;
32
- acc [ `../blocks/${ entryKey } ` ] = filePath ;
32
+ acc [ `../blocks/${ entryKey } /index ` ] = filePath ;
33
33
return acc ;
34
34
} , { } ) ;
35
35
@@ -39,7 +39,7 @@ const blockScssPaths = glob
39
39
const entryKey = filePath
40
40
. replace ( './assets/blocks/' , '' )
41
41
. replace ( '/style.scss' , '' ) ;
42
- acc [ `../blocks/${ entryKey } ` ] = filePath ;
42
+ acc [ `../blocks/${ entryKey } /style ` ] = filePath ;
43
43
return acc ;
44
44
} , { } ) ;
45
45
@@ -51,6 +51,28 @@ const styleScssPaths = glob
51
51
return acc ;
52
52
} , { } ) ;
53
53
54
+ // CopyPlugin patterns to include PHP and JSON files
55
+ const copyPluginPatterns = [
56
+ {
57
+ from : './assets/blocks/**/*.php' ,
58
+ to : ( { context, absoluteFilename } ) => {
59
+ return absoluteFilename . replace (
60
+ `${ context } /assets/blocks/` ,
61
+ '../blocks/'
62
+ ) ;
63
+ } ,
64
+ } ,
65
+ {
66
+ from : './assets/blocks/**/*.json' ,
67
+ to : ( { context, absoluteFilename } ) => {
68
+ return absoluteFilename . replace (
69
+ `${ context } /assets/blocks/` ,
70
+ '../blocks/'
71
+ ) ;
72
+ } ,
73
+ } ,
74
+ ] ;
75
+
54
76
module . exports = {
55
77
...defaultConfig ,
56
78
entry : {
@@ -177,6 +199,7 @@ module.exports = {
177
199
context : path . resolve ( process . cwd ( ) , 'assets/fonts' ) ,
178
200
noErrorOnMissing : true ,
179
201
} ,
202
+ ...copyPluginPatterns , // Include patterns for PHP and JSON files
180
203
] ,
181
204
} ) ,
182
205
0 commit comments