Skip to content

Commit

Permalink
use unique jsonpFunction name in webpack config to avoid conflict wit…
Browse files Browse the repository at this point in the history
…h other plugins built with @wordpress/scripts (see: WordPress/gutenberg#23607)
  • Loading branch information
tschortsch committed Nov 13, 2020
1 parent fa6f4be commit 54f1e12
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '67aee816442ce60ef154e852f39f18fa');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => 'dc6e4660f672db61a119525dff6a9e5b');
2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ Please create a new GitHub issue and let us know: [https://github.com/liip/boots

== Changelog ==

= 3.1.1 =

* [FIX] Use unique `jsonpFunction` name in webpack config to avoid conflict with other plugins built with `@wordpress/scripts`. (Thanks CP-Antoine for the hint)

= 3.1.0 =

* [FEATURE] Add possibility to open link of `button` block in new tab.
Expand Down
15 changes: 15 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const config = require( '@wordpress/scripts/config/webpack.config' );

/**
* Because the block and the package have their own webpack configuration,
* they must provide a unique name for the global scope (which is used to lazy-load chunks),
* otherwise it throws a JS error when loading blocks compiled with `npm run build`
*
* @see https://github.com/WordPress/gutenberg/issues/23607
* @see https://v4.webpack.js.org/configuration/output/#outputjsonpfunction
*/
// ------------------------------------------------------
config.output.jsonpFunction = 'wpBootstrapBlocksJsonpFn';
// ------------------------------------------------------

module.exports = config;

0 comments on commit 54f1e12

Please sign in to comment.