Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Document the build process (Webpack) #8982

Closed
aduth opened this issue Aug 14, 2018 · 6 comments
Closed

Documentation: Document the build process (Webpack) #8982

aduth opened this issue Aug 14, 2018 · 6 comments
Labels
[Type] Build Tooling Issues or PRs related to build tooling [Type] Developer Documentation Documentation for developers [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@aduth
Copy link
Member

aduth commented Aug 14, 2018

Our build process, specifically the Webpack build, implements a fair bit of "magic" in order to define globals on the wp namespace, and to update import references to leverage these globals. We should document how this process works to educate those who might be interested in interfacing, modifying, or extending those behaviors.

https://github.com/WordPress/gutenberg/blob/master/webpack.config.js

Open questions:

  • What should specifically be documented?
  • Where should documentation be added?

cc @adamsilverstein @BE-Webdesign

@aduth aduth added [Type] Task Issues or PRs that have been broken down into an individual action to take [Type] Developer Documentation Documentation for developers [Type] Build Tooling Issues or PRs related to build tooling labels Aug 14, 2018
@buzztone
Copy link

Our experience is that understanding and using JS build tools is the biggest initial barrier to getting WordPress Devs (with experience in PHP & jQuery) working with React in WordPress.

They need to get our build tools working on their local dev environment before starting to learn how we are writing our React based WordPress plugin. It's a big step for them & we've written a lot of very specific detailed documentation to help them through this process.

I'm also myself still working hard to understand the Gutenberg JS build tools (especially webpack but also babel). I've followed the package.json & webpack.config.js files in Gutenberg for some time. I've often struggled to find explanations for much of what I see there. These files also got increasingly complex over time & I've not found explanations for most of the changes.

It would be great if others like me could use the Gutenberg JS build tools as a starting or reference point for our projects. We currently use an ejected version of create-react-app but are increasingly referring to and adding parts from the Gutenberg build process which help us deal better with using React within WordPress.

Documentation of this area would hopefully allow me to understand:

  • how the Gutenberg build process works
  • why each package/option etc. is used
  • when things are changed why they are changed.

@aduth
Copy link
Member Author

aduth commented Aug 15, 2018

I've followed the package.json & webpack.config.js files in Gutenberg for some time. I've often struggled to find explanations for much of what I see there. These files also got increasingly complex over time & I've not found explanations for most of the changes.

Highlighting this as it makes for a good argument that inline code documentation (i.e. comments) could, in some instances, serve better than a single separate document in order to reduce the "distance" between the code itself and the explanation of what it's intending to implement.

@krisgale-zz
Copy link

krisgale-zz commented Aug 15, 2018

The converse of that^ is that there are no good, straightforward recipes/cookbooks available.

@gziolo
Copy link
Member

gziolo commented Oct 11, 2018

We should make sure we document how one can take advantage of global variables to do some advanced work:

  • GUTENBERG_BUNDLE_ANALYZER
  • GUTENBERG_DEVTOOL
  • GUTENBERG_LIVE_RELOAD_PORT

@youknowriad youknowriad removed this from the Documentation & Handbook milestone Mar 18, 2019
@gziolo
Copy link
Member

gziolo commented Mar 18, 2019

We have some great progress on this one now that we abstracted webpack behind @wordpress/scripts package. We have documented the following:

@gziolo
Copy link
Member

gziolo commented Mar 18, 2019

We should make sure we document how one can take advantage of global variables to do some advanced work:

  • GUTENBERG_BUNDLE_ANALYZER
  • GUTENBERG_DEVTOOL
  • GUTENBERG_LIVE_RELOAD_PORT

I created a follow-up issue for this part: #14492.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Build Tooling Issues or PRs related to build tooling [Type] Developer Documentation Documentation for developers [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

6 participants