Fix loading opt-in block metadata

Build version of plugin doesn't contain assets/js folder.
We need to copy block.json file with the metadata to assets/dist directory and load it from there.
[MAILPOET-3920]
This commit is contained in:
Rostislav Wolny
2021-11-18 14:07:09 +01:00
committed by Veljko V
parent e9202d840a
commit ae33ab8d82
2 changed files with 9 additions and 1 deletions

View File

@@ -59,7 +59,7 @@ class WooCommerceBlocksIntegration {
'__experimental_woocommerce_blocks_add_data_attributes_to_block',
[$this, 'addDataAttributesToBlock']
);
$this->wp->registerBlockType(Env::$assetsPath . '/js/src/marketing_optin_block');
$this->wp->registerBlockType(Env::$assetsPath . '/dist/js/marketing_optin_block');
$this->extendRestApi();
}

View File

@@ -488,6 +488,14 @@ const marketingOptinBlock = Object.assign({}, wpScriptConfig, {
requestToExternal,
requestToHandle,
}),
new WebpackCopyPlugin({
patterns: [
{
from: 'assets/js/src/marketing_optin_block/block.json',
to: 'block.json',
},
],
}),
],
});