diff --git a/src/configuration/package-json.md b/src/configuration/package-json.md index 9c09c0116..1e0585ea0 100644 --- a/src/configuration/package-json.md +++ b/src/configuration/package-json.md @@ -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` \ No newline at end of file +| 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` | diff --git a/src/features/cli.md b/src/features/cli.md index 21993cd31..765ef5919 100644 --- a/src/features/cli.md +++ b/src/features/cli.md @@ -55,29 +55,29 @@ As opposed to `serve` and `watch`, `build` has [scope hoisting](/features/scope- ### General parameters -| Format | Description | -| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| `--cache-dir ` | 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,
Overrides [`targets.*.sourceMaps`](/getting-started/configuration/#sourcemap) | -| `--profile` | Profiles the build (a flamechart can be generated) | -| `--public-url ` | The path prefix for absolute urls.
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 ` | 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,
Overrides [`targets.*.sourceMap`](/configuration/package-json/#sourcemap) | +| `--profile` | Profiles the build (a flamechart can be generated) | +| `--public-url ` | The path prefix for absolute urls.
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 ` | The port for the HMR and HTTP server (the default port is `process.env.PORT` or 1234) | -| `--host ` | Sets the host to listen on, defaults to listening on all interfaces | -| `--https` | Serves files over HTTPS | -| `--cert ` | Path to a certificate to use with HTTPS | -| `--key ` | 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 ` | The port for the HMR and HTTP server (the default port is `process.env.PORT` or 1234) | +| `--host ` | Sets the host to listen on, defaults to listening on all interfaces | +| `--https` | Serves files over HTTPS | +| `--cert ` | Path to a certificate to use with HTTPS | +| `--key ` | Path to a private key to use with HTTPS | +| `--watch-for-stdin` | Stop Parcel once stdin is closed | ### Parameters specific to `serve` @@ -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 ` | Output directory to write to when unspecified by targets.
Default value for [`targets.*.distDir`](/getting-started/configuration/#targets-2) | +| Format | Description | +| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | +| `--dist-dir ` | Output directory to write to when unspecified by targets.
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).
Related [`targets.*.minify`](/getting-started/configuration/#targets-2) | -| `--no-scope-hoist` | Disables scope hoisting.
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).
Related [`targets.*.minify`](/configuration/package-json/#targets) | +| `--no-scope-hoist` | Disables scope hoisting.
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 | diff --git a/src/features/code-splitting.md b/src/features/code-splitting.md index 8a68b5515..227ca066a 100644 --- a/src/features/code-splitting.md +++ b/src/features/code-splitting.md @@ -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`. ---> \ No newline at end of file +--> diff --git a/src/features/production.md b/src/features/production.md index 77f42a526..4b0b294e6 100644 --- a/src/features/production.md +++ b/src/features/production.md @@ -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. @@ -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) - - \ No newline at end of file + diff --git a/src/getting-started/configuration.md b/src/getting-started/configuration.md index 00f751815..17b384ae6 100644 --- a/src/getting-started/configuration.md +++ b/src/getting-started/configuration.md @@ -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 `](cli/) -2. `$ parcel ` uses [`/package.json#source`](#source) (respectively) +1. [`$ parcel `](/features/cli/) +2. `$ parcel ` uses [`/package.json#source`](/configuration/package-json/#source) (respectively) 3. `./src/index.*` 4. `./index.*` @@ -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`]() 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`](>) 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/`. @@ -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/) diff --git a/src/getting-started/migration.md b/src/getting-started/migration.md index 81f6f5c1c..e2332e3ff 100644 --- a/src/getting-started/migration.md +++ b/src/getting-started/migration.md @@ -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]()) +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]()) {% migration %} {% samplefile "index.js" %} @@ -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`. @@ -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 @@ -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 %} @@ -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` @@ -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 %}