Skip to content

Commit

Permalink
Prevent copying PHP files from src/ into assets/
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
delawski committed Mar 2, 2022
1 parent 0d4326a commit 78e0341
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion webpack.config.js
Expand Up @@ -50,7 +50,18 @@ const sharedConfig = {
return plugin;
},
)
.filter( ( plugin ) => plugin.constructor.name !== 'CleanWebpackPlugin' ),
.filter( ( plugin ) => ! [
'CleanWebpackPlugin',
/**
* 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`.
*
* @see https://github.com/ampproject/amp-wp/issues/6947
*/
'CopyWebpackPlugin',
].includes( plugin.constructor.name ) ),
new RtlCssPlugin( {
filename: '../css/[name]-rtl.css',
} ),
Expand Down

0 comments on commit 78e0341

Please sign in to comment.