0

I am building a plugin that does many things, one of them being adding a Gutenberg custom block. I am wondering how to structure this. Can I use @wordpress/scripts to bundle the JavaScript or TypeScript that is NOT part of the custom Gutenberg block? And if yes, can you explain how? Or should I just separate this into two plugins? (I'd rather not)

1
  • WP Scripts are just a prebuilt webpack config, nothing stops you taking it and modifying it, or ignoring it completely. Anything that compiles JSX into a bundle will do the job, the only thing to note is that imports on @wordpress/... packages are mapped onto window.wp..... which is something any webpack config can do and is documented on the official webpack docs. Likewise a webpack config can build multiple things and have multiple final outputs. WP Scripts is just there to help people because webpack is scary to newcomers so having a command that gives you a preset is helpful
    – Tom J Nowell
    Jan 30 at 22:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.