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

docs(examples): add yarn add webpack-cli step #7174

Merged
merged 1 commit into from
May 25, 2018

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented May 2, 2018

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 without webpack-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 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.

Does this PR introduce a breaking change?
No

Other information
No

Alternative Solution
Add webpack-cli to devDependencies.

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.
@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@webpack-bot
Copy link
Contributor

webpack-bot commented May 15, 2018

For maintainers only:

  • This need to be documented (issue in webpack/webpack.js.org will be filed when merged)

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.
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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.
Copy link
Member

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.

@sokra sokra merged commit 5feb7e6 into webpack:master May 25, 2018
@sokra
Copy link
Member

sokra commented May 25, 2018

Thanks

@JLHwung JLHwung deleted the revise-examples-build-readme branch May 26, 2018 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants