Skip to content

Commit 7e92b0c

Browse files
martinstuecklschwaigerAhmad Awais ⚡️
authored andcommitted
📦 NEW: Add lodash dependency (#143)
* Add lodash dependency I think this should fix #133. `window.lodash` is already present in Gutenberg. `window._` is underscore. If you import `lodash` in the code, it will override `window._` with lodash, which will cause weird bugs in totally unrelated places. Adding lodash here will prevent webpack from including `lodash` in the output, so it won't cause any conflicts. ### How to test this #133 only happend on my system, if I installed some other plugins. The easiest way to reproduce it, is to install the `TinyMCE Advanced` plugin. In your block code: Add `import { compose } from "@wordpress/compose";` to one of the JavaScript files. `@wordpress/compose` exports `flowRight` from `lodash` as `compose`, so it imports `lodash`. This will cause lodash to be included in your build. I created a repository to show this: https://github.com/martinstuecklschwaiger/gutenberg-example * 🐛 FIX: Grammar
1 parent b715045 commit 7e92b0c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

packages/cgb-scripts/config/externals.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const externals = [
4141
react: 'React', // React itself is there in Gutenberg.
4242
jquery: 'jQuery', // import $ from 'jquery' // Use the WordPress version after enqueuing it.
4343
'react-dom': 'ReactDOM',
44+
lodash: 'lodash', // Lodash is there in Gutenberg.
4445
}
4546
);
4647

0 commit comments

Comments
 (0)