How Webpack and WordPress packages interact #15
Replies: 3 comments 2 replies
-
@bph I'd like to take this on. There are a lot of items to unpack here but I think this ties into the work I've down with both the scripts and create-block packages. |
Beta Was this translation helpful? Give feedback.
2 replies
-
This discussion was converted to an issue for the project. Please continue feedback etc. there. This discussion is locked. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Closed the discussion after post was published by @ryanwelcher How webpack and WordPress packages interact |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
During the discussion Issue #8
@andrewlimaza commented
"The main hurdle is the tooling around here and not fully understanding webpack. We tweak the wordpress/scripts webpack to adjust the entry and output points to fit our file structure. What we need is to output to assets/js and entry point would be /blocks (with various subfolders).
Right now, it nukes everything in the assets/js whenever you use wp-scripts start or build. Not sure if this is a NPM version thing or if there's a setting we can use to keep pre-existing files (other .js files for plugin frontend/admin etc) and just rebuild the files we need (i.e. blocks.build.js).
Also a standardized file structure for blocks (within a plugin) would help us, this is something we're working on for our own team (not paving the way for WP) but with the ever evolving tools and understanding of blocks we need to neaten this up internally as we built blocks before wp-scripts was a thing or we just didn't know about it (I can't remember 5 years ago what was our thought approach). We have moved over to wp-scripts ever since which made things easier but still gets confusing to troubleshoot this when things don't work. Our goal now is to to move to a set file structure and webpack config in upcoming plugins that already have shortcodes and other /js files. We have made some workarounds but I don't feel that these are ideal."
There definitely a need to elaborate on the interaction between Webpack and WordPress scripts, to guide developers through the build process and make adopting some tools easier. What do you think should be covered in a first blog post about it?
Beta Was this translation helpful? Give feedback.
All reactions