ahmadawais / create-guten-block

📦 A zero-configuration #0CJS developer toolkit for building WordPress Gutenberg block plugins.
https://Awais.dev/cgb-post
MIT License
3.15k stars 327 forks source link

Failing to import @wordpress/dom-ready #282

Open clovis1122 opened 4 years ago

clovis1122 commented 4 years ago

Bug Report

Expected Behavior

I'm trying to use the import ... from @wordpress/... syntax. Writing import domReady from @wordpress/dom-ready should build successfully, and it should refer to wp.domReady.

Actual Behavior

I receive the "module not found" error. image.

I think this is very easy to fix by adding "dom-ready" here: https://github.com/ahmadawais/create-guten-block/blob/bdc40192fc7fa30519d821e2aa835b2aa6ef7534/packages/cgb-scripts/config/externals.js#L20. Let me know if this is correct.

clovis1122 commented 4 years ago

I think @wordpress/compose also presents the same issue. @ahmadawais would it be possible to make it so that when something is imported from @wordpress/whatever, it is accessed as wp[camelCaseDash(whatever)]?