Skip to content

Commit 78e0341

Browse files
committed
Prevent copying PHP files from src/ into assets/
After introducing WordPress/gutenberg#38715, PHP files from the `src` folder are copied over to the output directory (i.e. `assets`). To prevent this, the `CopyWebpackPlugin` is excluded from the plugins list. It is safe since the only other file type the plugin copies is `block.json` that is not used in `amp-wp`.
1 parent 0d4326a commit 78e0341

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

webpack.config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ const sharedConfig = {
5050
return plugin;
5151
},
5252
)
53-
.filter( ( plugin ) => plugin.constructor.name !== 'CleanWebpackPlugin' ),
53+
.filter( ( plugin ) => ! [
54+
'CleanWebpackPlugin',
55+
/**
56+
* After introducing WordPress/gutenberg#38715, PHP files from the `src` folder are copied over
57+
* to the output directory (i.e. `assets`). To prevent this, the `CopyWebpackPlugin` is excluded
58+
* from the plugins list. It is safe since the only other file type the plugin copies is `block.json`
59+
* that is not used in `amp-wp`.
60+
*
61+
* @see https://github.com/ampproject/amp-wp/issues/6947
62+
*/
63+
'CopyWebpackPlugin',
64+
].includes( plugin.constructor.name ) ),
5465
new RtlCssPlugin( {
5566
filename: '../css/[name]-rtl.css',
5667
} ),

0 commit comments

Comments
 (0)