docs(examples): add yarn add webpack-cli step - #7174
Merged
Merged
Conversation
Running node_modules/bin/webpack without webpack-cli installed will get hang. The culprit is that webpack expects a stdin of whether to install webpack-cli or not. However, as examples/build-common use `child_process.exec` to execute `webpack`, the user will not be prompted for any questions since the stdin is not piped and the stdout will be pass to parent process only after the child process exits. We can keep build-common simple by instructing devs to install webpack-cli before they build examples. Also rewrite the install step using yarn since we use yarn in webpack.
Contributor
|
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
Contributor
|
For maintainers only:
|
| 3. Run `node build.js` in the specific example directory. (Ex: `cd examples/commonjs && node build.js`) | ||
| 1. Run `yarn` in the root of the project. | ||
| 2. Run `yarn link webpack` in the root of the project. | ||
| 3. Run `yarn add --dev webpack-cli` in the root of the project. |
Member
There was a problem hiding this comment.
What about if i use npm? Looks like better have two variants
Contributor
Author
There was a problem hiding this comment.
Here, yarn is used to align with https://github.com/webpack/webpack/blob/master/_SETUP.md#setup. Personally I am good to either one as long as documented in contribution guide.
Member
There was a problem hiding this comment.
It must be yarn. npm don't read the yarn.lock file so it yields different results.
sokra
approved these changes
May 25, 2018
| 3. Run `node build.js` in the specific example directory. (Ex: `cd examples/commonjs && node build.js`) | ||
| 1. Run `yarn` in the root of the project. | ||
| 2. Run `yarn link webpack` in the root of the project. | ||
| 3. Run `yarn add --dev webpack-cli` in the root of the project. |
Member
There was a problem hiding this comment.
It must be yarn. npm don't read the yarn.lock file so it yields different results.
Member
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
docs change
Did you add tests for your changes?
No
If relevant, link to documentation update:
No
Summary
Running
node cd examples/commonjs && node ./build.jswithoutwebpack-cliinstalled will get hang.The culprit is that webpack expects a stdin user input of whether to install webpack-cli or not. However, as examples/build-common uses
child_process.execto executewebpack, the user will not be prompted for any questions since the stdin is not piped and the stdout will be pass to parent process only after the child process exits. We can keep build-common simple by instructing devs to install webpack-cli before they build examples.Also rewrite the install step using yarn since we use yarn in webpack.
Does this PR introduce a breaking change?
No
Other information
No
Alternative Solution
Add
webpack-clitodevDependencies.