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: update install commands and babel config #13853

Merged
merged 2 commits into from
Feb 15, 2019

Conversation

oandregal
Copy link
Member

This PR fixes some problems I ran into when following the current guide. It also promotes the use of --save-exact as a good hygiene practice.

  • It asked me to install a webpack CLI (so I included it in the install commands):

webcli-required

  • It failed to compiled due to incompatible babel packages:

build-fail

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure why --save-exact solves this issue given that both webpack and @wordpress/scripts follow semantic versioning. However if that helps, I'm fine with the changes proposed.

@oandregal
Copy link
Member Author

@gziolo --save-exact is not required and can totally be dropped from this PR. It's a personal preference that I thought it was worth promoting as a good practice. I'm fine removing that from the PR if that's controversial.

@gziolo
Copy link
Member

gziolo commented Feb 13, 2019

It might be something about the dependencies included by @wordpress/scripts. It's hard to judge based on Gutenberg because there are thousands of dependencies listed. I assume this is going to be no issue as soon as we have the default Webpack config included in the scripts exposed by the package we offer :)

@oandregal
Copy link
Member Author

The root problem seems related to babel-loader@8 requiring @babel/plugin-transform-react-jsx while babel-loader@7 requires babel-plugin-transform-jsx, which is a different thing, apparently. So depending on which version of babel-loader gets installed, the other dependencies need to be adjusted.

@gziolo
Copy link
Member

gziolo commented Feb 14, 2019

Do you know what is using Babel 6 specific packages causing babel-loader@7 to be pulled in?

@oandregal
Copy link
Member Author

@gziolo not sure I follow. Here's what I know:

  • Installing babel-loader will pull the latest version (8). That version requires @babel/plugin-transform-react-jsx.
  • If we wanted to use babel-plugin-transform-react-jsx we should explicitly install babel-loader@7.

I chose to go with the first option because that's what Gutenberg uses.

@gziolo
Copy link
Member

gziolo commented Feb 15, 2019

  • If we wanted to use babel-plugin-transform-react-jsx we should explicitly install babel-loader@7.

Why would you want to install it in the first place?

I chose to go with the first option because that's what Gutenberg uses.

Yes, this is highly expected.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update for the time being and wait until we can address #13712 to make it perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants