-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
docs(examples): add yarn add webpack-cli step #7174
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.
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about if i use npm
? Looks like better have two variants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It must be yarn
. npm don't read the yarn.lock file so it yields different results.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It must be yarn
. npm don't read the yarn.lock file so it yields different results.
Thanks |
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.js
withoutwebpack-cli
installed 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.exec
to 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-cli
todevDependencies
.