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

Let's ship the webpack 4 documentation #1856

Merged
merged 39 commits into from
Mar 20, 2018
Merged

Let's ship the webpack 4 documentation #1856

merged 39 commits into from
Mar 20, 2018

Conversation

sokra
Copy link
Member

@sokra sokra commented Feb 26, 2018

Merge the next branch.

MagicDuck and others added 24 commits February 6, 2018 23:19
This moves some of the content from `compiler.md` and brings it into the
main node api documentation in order to allow `compiler.md` to become
`compiler-hooks.md` which fits better in the context of plugins.
…le.md`

This moves some of the `Tapable` discussion to the lead-in `plugins.md` to
prevent doc duplication. Instead of redocumenting the `tapable` package, we
should focus on improving the README and simply link to there throughout
our docs. As I've mentioned before, we can also create a "Utilities" section
for things other than "Loaders" and "Plugins" that we want to dynamically
pull in.
These guides were full of todos and probably lead to more confusion
than clarity. We can discuss more and add them back in once there's
a clear flow for how to incorporate and document them.
This page now focuses specifically on the `hooks` as all the non-plugin related
content was moved to `node.md`. I updated the hooks to the new syntax, added
all undocumented hooks, reformatted each hook as a section to allow more
breathing room, and clarified exactly which `tapable` hook is used for each
section. Still need to get more info on some of the new hooks before we can
ship this...
This page now uses the same section setup as `compiler-hooks.md` and
is up to date with the latest hooks available in the webpack 4 alpha release.
Improve lead-in to give a little more context on what the parser does. Add
the latest hooks and use the same layout as the other pages in the section.
Updates the Get Started guide to use webpack 4 and adds some additional information about npm.
Update the plugins page in the concepts section to be compatible with webpack 4. Also adds a note about referencing the plugin name in camel-case when calling the `tap` method.
@skipjack
Copy link
Collaborator

skipjack commented Mar 3, 2018

We should definitely merge soon but whoever does please tag master with the latest v3 version so we can easily grab the last stable v3 docs if version switching (via a dropdown or something) is ever added.

osenvosem and others added 3 commits March 3, 2018 14:27
This adds the `builtAt` option to the example configuration.
This adds valid doctypes to all the HTML examples in the Get Started guide.
This adds a table of config options for v4 to the API documentation.
@montogeek
Copy link
Member

montogeek commented Mar 14, 2018

@TheLarkInn What you think about versioning the website?
We could also setup Netlify or just deploy current master on GH pages under a subdirectory 3 for example.

T> For a high-level introduction to writing plugins, start with [writing a plugin](/contribute/writing-a-plugin).
Plugins are a key piece of the webpack ecosystem and provide the community with
a powerful way to tap into webpack's compilation process. A plugin is able to
[hook]() into key events that are fired throughout each compilation. Every step
Copy link
Member

Choose a reason for hiding this comment

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

[hook]() Missing a link here?

---

At its core, *webpack* is a _static module bundler_ for modern JavaScript applications. When webpack processes your application, it recursively builds a _dependency graph_ that includes every module your application needs, then packages all of those modules into one or more _bundles_.

T> Learn more about JavaScript modules and webpack modules [here](/concepts/modules).

It is [incredibly configurable](/configuration), but to get started you only need to understand four **Core Concepts**:
Since v4.0.0 webpack does not require a configuration file. Nevertheless, it is [incredibly configurable](/configuration). To get started you only need to understand four **Core Concepts**:
Copy link
Member

Choose a reason for hiding this comment

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

Can we rephrase this better? Maybe include "0CJS"?

@@ -31,7 +32,7 @@ An **entry point** indicates which module webpack should use to begin building o

Every dependency is then processed and outputted into files called *bundles*, which we'll discuss more in the next section.

You can specify an entry point (or multiple entry points) by configuring the `entry` property in the [webpack configuration](/configuration).
You can specify an entry point (or multiple entry points) by configuring the `entry` property in the [webpack configuration](/configuration). It defaults to `./src`.
Copy link
Member

@dhruvdutt dhruvdutt Mar 15, 2018

Choose a reason for hiding this comment

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

We should clearly mention the default filename along with directory. ./src/index.js

@@ -48,7 +49,7 @@ T> You can configure the `entry` property in various ways depending the needs of

## Output

The **output** property tells webpack where to emit the *bundles* it creates and how to name these files. You can configure this part of the process by specifying an `output` field in your configuration:
The **output** property tells webpack where to emit the *bundles* it creates and how to name these files and defaults to `./dist`. You can configure this part of the process by specifying an `output` field in your configuration:
Copy link
Member

@dhruvdutt dhruvdutt Mar 15, 2018

Choose a reason for hiding this comment

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

We should clearly mention the default filename along with directory. ./dist/bundle.js

or pass it as a cli argument:

```bash
webpack --mode=production
Copy link
Member

Choose a reason for hiding this comment

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

--mode production

Copy link
Member

Choose a reason for hiding this comment

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

Can we also mention the precedence of mode if it's present in both config and via cli?

Copy link
Member

Choose a reason for hiding this comment

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

--mode=production is valid too

Copy link
Member

@dhruvdutt dhruvdutt Mar 15, 2018

Choose a reason for hiding this comment

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

--mode production looks cleaner to me. Anyways, either is fine. 👍

@@ -144,20 +177,25 @@ In this setup, `index.js` explicitly requires `lodash` to be present, and binds
With that said, let's run `npx webpack` with our script as the [entry point](/concepts/entry-points) and `bundle.js` as the [output](/concepts/output). The `npx` command, which ships with Node 8.2 or higher, runs the webpack binary (`./node_modules/.bin/webpack`) of the webpack package we installed in the beginning:
Copy link
Member

Choose a reason for hiding this comment

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

We should add a note or command here for users using Node < 8.2.

update tree shaking guide for webpack 4
Copy link
Member

@dhruvdutt dhruvdutt left a comment

Choose a reason for hiding this comment

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

We need to remove package-lock.json #1917
We already have a yarn.lock file. Keeping both lock files would create sync issues.

@TheLarkInn
Copy link
Member

Looks like a tree shaking guide is still conflicting. Does anyone want to grab those conflicts?

@dhruvdutt
Copy link
Member

@TheLarkInn Already resolved it a couple of days ago. #1923
Rebased again.

dhruvdutt and others added 2 commits March 19, 2018 19:51
* Update gitignore

* Resolve conflicts

* Resolve conflicts
@TheLarkInn
Copy link
Member

Did a branch sync also via UI.

Copy link
Member

@TheLarkInn TheLarkInn 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 going to approve this. I feel pretty good about the state as is. Would someone be willing to open up.individual issues for things that look problematic from a content standpoint. Ideally we should get these surfaced to new contribs and more smaller PRs.

@TheLarkInn
Copy link
Member

GitHub rate limit causing errors in CI.

Copy link
Member

@dhruvdutt dhruvdutt left a comment

Choose a reason for hiding this comment

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

LGTM except for minor improvements which could be dealt later. ⏳

webpack 4 🔥 🔥 🔥

@@ -39,7 +39,7 @@ noted.
## Plugin Types

Depending on the hooks used and `tap` methods applied, plugins can function in
a number of different ways. The way this works is closely related to the
a different number of ways. The way this works is closely related to the
Copy link

@Hypnosphi Hypnosphi Mar 19, 2018

Choose a reason for hiding this comment

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

Is the change in meaning intended here?

I'm no native speaker, but looks like before it said "there are many ways, and it depends which way it will be actually", and now it's says "there may be many or not so many ways, it depends"

Copy link
Member

Choose a reason for hiding this comment

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

This is still evaluated the same.

Copy link

Choose a reason for hiding this comment

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

FWIW I'm a non-native speaker as well and the previous version of this sentence sounded more understandable to me.

Copy link
Member

Choose a reason for hiding this comment

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

To me it sounds like the plugins, before, could work in various ways; but now it sounds like they work in a different amount of ways (???)

Choose a reason for hiding this comment

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

the previous sounds clearer to me.

@TheLarkInn TheLarkInn merged commit 6c2ab16 into master Mar 20, 2018
@montogeek
Copy link
Member

Finally 🎆

@edmorley
Copy link
Contributor

This review comment still applies:
#1856 (comment)

@TheLarkInn
Copy link
Member

@edmorley would you be willing to create a separate issue for this and tie it to this PR so we have visibility and linkage?

@edmorley
Copy link
Contributor

Sure - filed #1947 :-)

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.