Skip to content

Commit

Permalink
Dead links (parcel-bundler#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic authored Jun 19, 2020
1 parent 0db2109 commit 6406b3c
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 53 deletions.
16 changes: 7 additions & 9 deletions src/configuration/package-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,14 @@ Specifies the [environment](#environments).

See [Module Resolution](/features/module-resolution/#aliases)



### Which `package.json` is used when specifying multiple entries (packages)

All paths are relative to `/some/dir/my-monorepo`.

| cwd | entries | used `pkg.json#*` (fields described below) |
|---|---| ---|
| `..` | `packages/*/src/**/*.js` | `package.json`
| `.` | `packages/*/src/**/*.js` | `package.json`
| `packages/` | `packages/*/src/**/*.js` | `package.json`
| `packages/pkg-a` | `packages/pkg-a/src/index.js` | `packages/pkg-a/package.json`
| `packages/pkg-a/src` | `packages/pkg-a/src/index.js` | `packages/pkg-a/package.json`
| cwd |  entries |  used `pkg.json#*` (fields described below)  |
| -------------------- | ----------------------------- | -------------------------------------------- |
| `..` | `packages/*/src/**/*.js` | `package.json` |
| `.` | `packages/*/src/**/*.js` | `package.json` |
| `packages/` | `packages/*/src/**/*.js` | `package.json` |
| `packages/pkg-a` | `packages/pkg-a/src/index.js` | `packages/pkg-a/package.json` |
| `packages/pkg-a/src` | `packages/pkg-a/src/index.js` | `packages/pkg-a/package.json` |
56 changes: 28 additions & 28 deletions src/features/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,29 @@ As opposed to `serve` and `watch`, `build` has [scope hoisting](/features/scope-

### General parameters

| Format | Description |
| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `--cache-dir <path>` | Sets the cache directory. defaults to `.parcel-cache` |
| `--log-level (none|error|warn|info|verbose)` | Sets the log level |
| `--no-autoinstall` | Disables autoinstall |
| `--no-cache` | Disables reading from the filesystem cache |
| `--no-source-maps` | Disables sourcemaps, <br> Overrides [`targets.*.sourceMaps`](/getting-started/configuration/#sourcemap) |
| `--profile` | Profiles the build (a flamechart can be generated) |
| `--public-url <url>` | The path prefix for absolute urls. <br> Default value for [`targets.*.publicUrl`](/getting-started/configuration/#targets-2) |
| `--target [name]` | Only build the specified target(s) |
| `-V, --version` | Outputs the version number |
| Format | Description |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `--cache-dir <path>` | Sets the cache directory. defaults to `.parcel-cache` |
| `--log-level (none|error|warn|info|verbose)` | Sets the log level |
| `--no-autoinstall` | Disables autoinstall |
| `--no-cache` | Disables reading from the filesystem cache |
| `--no-source-maps` | Disables sourcemaps, <br> Overrides [`targets.*.sourceMap`](/configuration/package-json/#sourcemap) |
| `--profile` | Profiles the build (a flamechart can be generated) |
| `--public-url <url>` | The path prefix for absolute urls. <br> Default value for [`targets.*.publicUrl`](/configuration/package-json/#targets) |
| `--target [name]` | Only build the specified target(s) |
| `-V, --version` | Outputs the version number |

### Parameters related to the dev server/watch mode (`serve` and `watch`)

| Format | Description |
| ------------------- | ------------------------------------------------------------------- |
| `--no-hmr` | Disables [hot module replacement](/features/hmr) |
| `-p, --port <port>` | The port for the HMR and HTTP server (the default port is `process.env.PORT` or 1234) |
| `--host <host>` | Sets the host to listen on, defaults to listening on all interfaces |
| `--https` | Serves files over HTTPS |
| `--cert <path>` | Path to a certificate to use with HTTPS |
| `--key <path>` | Path to a private key to use with HTTPS |
| `--watch-for-stdin` | Stop Parcel once stdin is closed |
| Format | Description |
| ------------------- | ------------------------------------------------------------------------------------- |
| `--no-hmr` | Disables [hot module replacement](/features/hmr) |
| `-p, --port <port>` | The port for the HMR and HTTP server (the default port is `process.env.PORT` or 1234) |
| `--host <host>` | Sets the host to listen on, defaults to listening on all interfaces |
| `--https` | Serves files over HTTPS |
| `--cert <path>` | Path to a certificate to use with HTTPS |
| `--key <path>` | Path to a private key to use with HTTPS |
| `--watch-for-stdin` | Stop Parcel once stdin is closed |

### Parameters specific to `serve`

Expand All @@ -87,14 +87,14 @@ As opposed to `serve` and `watch`, `build` has [scope hoisting](/features/scope-

### Parameters specific to the non-server commands (`watch` and `build`)

| Format | Description |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--dist-dir <dir>` | Output directory to write to when unspecified by targets. <br> Default value for [`targets.*.distDir`](/getting-started/configuration/#targets-2) |
| Format | Description |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `--dist-dir <dir>` | Output directory to write to when unspecified by targets. <br> Default value for [`targets.*.distDir`](/configuration/package-json/#targets) |

### Parameters specific to `build`

| Format | Description |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `--no-minify` | Disables minification (exact behaviour is determined by plugins). <br> Related [`targets.*.minify`](/getting-started/configuration/#targets-2) |
| `--no-scope-hoist` | Disables scope hoisting. <br> Related: [`targets.*.scopeHoist`](/getting-started/configuration/#targets-2) |
| `--detailed-report [depth]` | Displays the largest 10 (number configurable with `depth`) assets per bundle in the CLI report |
| Format | Description |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `--no-minify` | Disables minification (exact behaviour is determined by plugins). <br> Related [`targets.*.minify`](/configuration/package-json/#targets) |
| `--no-scope-hoist` | Disables scope hoisting. <br> Related: [`targets.*.scopeHoist`](/configuration/package-json/#targets) |
| `--detailed-report [depth]` | Displays the largest 10 (number configurable with `depth`) assets per bundle in the CLI report |
2 changes: 1 addition & 1 deletion src/features/code-splitting.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ This means you don't need to configure where bundles should be loaded from, but
Parcel currently resolves bundles at the following protocols: `http`, `https`, `file`, `ftp`, `chrome-extension` and `moz-extension`.
-->
-->
5 changes: 2 additions & 3 deletions src/features/production.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ TODO

Parcel has builtin plugins for a few tools to help with analyzing bundle size.

### Bundle Analyzer
### Bundle Analyzer

To generate a HTML file for every bundle, set the `PARCEL_BUNDLE_ANALYZER` environment variable.

Expand Down Expand Up @@ -40,5 +40,4 @@ and use the files (in the dist directory) on [the Bundle Buddy website](https://

![A screenshot of the Bundle Buddy website with a loaded project](/assets/bundle-buddy.png)


</div>
</div>
12 changes: 6 additions & 6 deletions src/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Every entrypoint will be processed (and outputted) once per target.
These are the files that contain the source code to your app before being
compiled by Parcel and are picked up by:

1. [`$ parcel <entries>`](cli/)
2. `$ parcel <folder(s)>` uses [`<folder>/package.json#source`](#source) (respectively)
1. [`$ parcel <entries>`](/features/cli/)
2. `$ parcel <folder(s)>` uses [`<folder>/package.json#source`](/configuration/package-json/#source) (respectively)
3. `./src/index.*`
4. `./index.*`

Expand All @@ -31,11 +31,11 @@ Parcel.

### Setting the output path

The path where the output bundles should be placed can be specified (in that order) using a top-level field in `package.json` (see [common targets](#main-%2F-module-%2F-browser) and [custom targets](#custom-targets)), using [`targets.*.distDir`](#targets) or the [`--dist-dir`](</getting-started/cli/#parameters-specific-to-the-non-server-commands-(watch-and-build)>) CLI parameter.
The path where the output bundles should be placed can be specified (in that order) using a top-level field in `package.json` (see [common targets](/configuration/package-json/#main-%2F-module-%2F-browser) and [custom targets](/configuration/package-json/#custom-targets)), using [`targets.*.distDir`](/configuration/package-json/#targets) or the [`--dist-dir`](</features/cli/#parameters-specific-to-the-non-server-commands-(watch-and-build)>>) CLI parameter.

Default values for the output folder

- for the [common targets](#main-%2F-module-%2F-browser) is `path.dirname(package.json#${targetName})`
- for the common targets is `path.dirname(package.json#${targetName})`
- for custom targets is `path.dirname(package.json#${targetName})` or `~/dist/${targetName}/`.

The implicit default target has the output folder `~/dist/`.
Expand Down Expand Up @@ -74,7 +74,7 @@ You can configure environments through [`targets`](/configuration/package-json/#

When you do need to configure Parcel, it will be in one of 3 places.

- If you need to configure the CLI, it will be a [CLI flag](cli/)
- If you need to configure the CLI, it will be a [CLI flag](/features/cli/)
- If you need to configure your package, it will be in the [`package.json`](/configuration/package-json/)
- If you need to configure something with your files or the Parcel asset
pipeline, it will be in [`.parcelrc`](plugin-config/)
pipeline, it will be in [`.parcelrc`](/configuration/plugin-configuration/)
11 changes: 5 additions & 6 deletions src/getting-started/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For the most part, you shouldn't have to change much when upgrading to Parcel 2:

### Importing non-code assets from Javascript

If you want import the url to an image (or a soundfile, etc.) from Javascript, you need to prepend `url:` to the module specifier (more details in [Plugin Configuration](</getting-started/plugin-config/#predefined-(offical)-named-pipelines>))
If you want import the url to an image (or a soundfile, etc.) from Javascript, you need to prepend `url:` to the module specifier (read more about named pipelines in [Plugin Configuration](</configuration/plugin-configuration/#predefined-(offical)-named-pipelines>))

{% migration %}
{% samplefile "index.js" %}
Expand Down Expand Up @@ -56,7 +56,7 @@ Alternatively, you can use a custom `.parcelrc` to opt into the old behaviour.

Parcel 1 transpiled TypeScript using `tsc` (the official TypeScript compiler). Parcel 2 instead uses Babel (using `@babel/preset-env`) by default. This has two notable consequences:

(The [TypeScript recipe](/recipes/typescript) contains more informations - and limitations - of Parcel's TypeScript handling.)
(The [TypeScript page](/languages/typescript) contains more informations - and limitations - of Parcel's TypeScript handling.)

###### `@babel/preset-typescript` Isn't inserted Automatically into a Custom `.babelrc`.

Expand Down Expand Up @@ -131,7 +131,7 @@ const DataComponent = () => {
{% samplefile "DataComponent.js" %}

```js/5
import gql from 'graphql-tag';
import gql from "graphql-tag";
import fetchDataQuery from "./fetchData.gql"; // fetchDataQuery is a string
Expand All @@ -150,7 +150,6 @@ const DataComponent = () => {
{% endsamplefile %}
{% endmigration %}


{% note %}
With Parcel 2's new plugin architecture, creating a plugin that parses the string into an AST at build time (as Parcel 1 did) is very easy.
{% endnote %}
Expand All @@ -159,7 +158,7 @@ With Parcel 2's new plugin architecture, creating a plugin that parses the strin

### `package.json#main`

Many `package.json`s (e.g. the one generated by `npm init`) contains `main: "index.js"` which ignored by most tools (for non-library projects). Parcel 2 will however use that value as the output path (see [Configuration#main](/getting-started/configuration#main-%2F-module-%2F-browser)),
Many `package.json`s (e.g. the one generated by `npm init`) contains `main: "index.js"` which ignored by most tools (for non-library projects). Parcel 2 will however use that value as the output path (see [Configuration#main](/configuration/package-json/#main-%2F-module-%2F-browser)),
for most web apps, this line should simply be removed.

### `--target`
Expand Down Expand Up @@ -251,7 +250,7 @@ parcel build index.js --target node --bundle-node-modules

{% note %}

This option is more versatile that the CLI parameter (you can also selectively include packages), see [Configuration#includeNodeModules](/getting-started/configuration/#includenodemodules) for all details.
This option is more versatile that the CLI parameter (you can also selectively include packages), see [Configuration#includeNodeModules](/configuration/package-json/#includenodemodules) for all details.

{% endnote %}

Expand Down

0 comments on commit 6406b3c

Please sign in to comment.