parcel 2.0.0-nightly.95 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -1492
- package/lib/cli.js +391 -131
- package/package.json +21 -14
- package/src/.eslintrc.json +1 -1
- package/src/cli.js +329 -137
package/README.md
CHANGED
|
@@ -1,1519 +1,66 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://parceljs.org/" target="_blank">
|
|
3
|
-
<img alt="Parcel" src="https://user-images.githubusercontent.com/19409/
|
|
3
|
+
<img alt="Parcel" src="https://user-images.githubusercontent.com/19409/135924939-03845d0b-e7bb-414b-89b6-e627dfa9f614.png" width="749">
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
[](#backers) [](#sponsors)
|
|
8
|
-
[](https://www.npmjs.com/package/parcel-bundler)
|
|
13
|
-
[](https://spectrum.chat/parcel)
|
|
8
|
+
[](https://dev.azure.com/devongovett/devongovett/_build/latest?definitionId=1)
|
|
9
|
+
[](https://www.npmjs.com/package/parcel)
|
|
10
|
+
[](https://www.npmjs.com/package/parcel)
|
|
11
|
+
[](https://discord.gg/XSCzqGRuvr)
|
|
14
12
|
[](https://twitter.com/parceljs)
|
|
15
13
|
|
|
14
|
+
Parcel is a zero configuration build tool for the web. It combines a great out-of-the-box development experience with a scalable architecture that can take your project from just getting started to massive production application.
|
|
15
|
+
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- 🚨 Friendly error logging experience - syntax highlighted code frames help pinpoint the problem.
|
|
18
|
+
- 😍 **Zero config** – Parcel supports many languages and file types out of the box, from web technologies like HTML, CSS, and JavaScript, to assets like images, fonts, videos, and more. It has a built in dev server with hot reloading, beautiful error diagnostics, and much more. No configuration needed!
|
|
19
|
+
- ⚡️ **Lighting fast** – Parcel's JavaScript compiler is written in Rust for native performance. Your code is built in parallel using worker threads, utilizing all of the cores on your machine. Everything is cached, so you never build the same code twice. It's like using watch mode, but even when you restart Parcel!
|
|
20
|
+
- 🚀 **Automatic production optimization** – Parcel optimizes your whole app for production automatically. This includes tree-shaking and minifying your JavaScript, CSS, and HTML, resizing and optimizing images, content hashing, automatic code splitting, and much more.
|
|
21
|
+
- 🎯 **Ship for any target** – Parcel automatically transforms your code for your target environments. From modern and legacy browser support, to zero config JSX and TypeScript compilation, Parcel makes it easy to build for any target – or many!
|
|
22
|
+
- 🌍 **Scalable** – Parcel requires zero configuration to get started. But as your application grows and your build requirements become more complex, it's possible to extend Parcel in just about every way. A simple configuration format and powerful plugin system that's designed from the ground up for performance means Parcel can support projects of any size.
|
|
24
23
|
|
|
25
24
|
## Getting Started
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
a `package.json` for your project if you haven't already.
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
yarn init
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Then with Yarn you can install `parcel` into your app:
|
|
35
|
-
|
|
36
|
-
```sh
|
|
37
|
-
yarn add --dev parcel@next
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
From there you just need to point Parcel at some of your entry files. Like if
|
|
41
|
-
you're building a website, an `index.html` file:
|
|
42
|
-
|
|
43
|
-
```html
|
|
44
|
-
<!DOCTYPE html>
|
|
45
|
-
<html lang="en">
|
|
46
|
-
<head>
|
|
47
|
-
<meta charset="utf-8" />
|
|
48
|
-
<title>My First Parcel App</title>
|
|
49
|
-
</head>
|
|
50
|
-
<body>
|
|
51
|
-
<h1>Hello, World!</h1>
|
|
52
|
-
</body>
|
|
53
|
-
</html>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Now if you just run:
|
|
57
|
-
|
|
58
|
-
```sh
|
|
59
|
-
yarn parcel index.html
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
You should get a URL that looks something like: `http://localhost:1234/`
|
|
63
|
-
|
|
64
|
-
Next you can start adding dependencies by specifying them in your code (however
|
|
65
|
-
your language specifies other assets). So for HTML we could create a
|
|
66
|
-
`styles.css` file next to our `index.html` file and include it with a `<link>`
|
|
67
|
-
tag.
|
|
68
|
-
|
|
69
|
-
```css
|
|
70
|
-
h1 {
|
|
71
|
-
color: hotpink;
|
|
72
|
-
font-family: cursive;
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
```html
|
|
77
|
-
<!DOCTYPE html>
|
|
78
|
-
<html lang="en">
|
|
79
|
-
<head>
|
|
80
|
-
<meta charset="utf-8" />
|
|
81
|
-
<title>My First Parcel App</title>
|
|
82
|
-
<link rel="stylesheet" href="./styles.css" />
|
|
83
|
-
</head>
|
|
84
|
-
<body>
|
|
85
|
-
<h1>Hello, World!</h1>
|
|
86
|
-
</body>
|
|
87
|
-
</html>
|
|
88
|
-
```
|
|
26
|
+
See the following guides in our documentation on how to get started with Parcel.
|
|
89
27
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
This file will later contain your javascript application.
|
|
94
|
-
|
|
95
|
-
```javascript
|
|
96
|
-
console.log("Hello World");
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
```html
|
|
100
|
-
<!DOCTYPE html>
|
|
101
|
-
<html lang="en">
|
|
102
|
-
<head>
|
|
103
|
-
<meta charset="utf-8" />
|
|
104
|
-
<title>My First Parcel App</title>
|
|
105
|
-
<link rel="stylesheet" href="./styles.css" />
|
|
106
|
-
<script src="./app.js"></script>
|
|
107
|
-
</head>
|
|
108
|
-
<body>
|
|
109
|
-
<h1>Hello, World!</h1>
|
|
110
|
-
</body>
|
|
111
|
-
</html>
|
|
112
|
-
```
|
|
28
|
+
* [Building a webapp with Parcel](https://parceljs.org/getting-started/webapp/)
|
|
29
|
+
* [Building a library with Parcel](https://parceljs.org/getting-started/library/)
|
|
30
|
+
* [Migrating from Parcel v1](https://parceljs.org/getting-started/migration/)
|
|
113
31
|
|
|
114
32
|
## Documentation
|
|
115
33
|
|
|
116
|
-
|
|
117
|
-
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
- [Introduction](#introduction)
|
|
121
|
-
- [Parcel CLI](#parcel-cli)
|
|
122
|
-
- [CLI Args & Flags](#cli-args--flags)
|
|
123
|
-
- [`parcel serve`](#parcel-serve)
|
|
124
|
-
- [`parcel watch`](#parcel-watch)
|
|
125
|
-
- [`parcel build`](#parcel-build)
|
|
126
|
-
- [`[...entries]`](#entries)
|
|
127
|
-
- [`--target [name]`](#--target-name)
|
|
128
|
-
- [`--open, -o [browser]`](#--open--o-browser)
|
|
129
|
-
- [`--host <host>`](#--host-host)
|
|
130
|
-
- [`--port <port>, -p`](#--port-port--p)
|
|
131
|
-
- [`--https`](#--https)
|
|
132
|
-
- [`--cert <path>`](#--cert-path)
|
|
133
|
-
- [`--key <path>`](#--key-path)
|
|
134
|
-
- [`--cache-dir <dir>`, `--no-cache`](#--cache-dir-dir---no-cache)
|
|
135
|
-
- [`--hot`, `--no-hot`](#--hot---no-hot)
|
|
136
|
-
- [`--hot-host <hostname>`](#--hot-host-hostname)
|
|
137
|
-
- [`--hot-port <port>`](#--hot-port-port)
|
|
138
|
-
- [`--[no-]source-maps`](#--no-source-maps)
|
|
139
|
-
- [`--autoinstall [npm/yarn], --no-autoinstall`](#--autoinstall-npmyarn---no-autoinstall)
|
|
140
|
-
- [`--log-level <level>`](#--log-level-level)
|
|
141
|
-
- [`--version, -v, -V`](#--version--v--v)
|
|
142
|
-
- [`--help, -h`](#--help--h)
|
|
143
|
-
- [Parcel Config](#parcel-config)
|
|
144
|
-
- [Configuring external tools](#configuring-external-tools)
|
|
145
|
-
- [Configuring Parcel](#configuring-parcel)
|
|
146
|
-
- [`package.json`](#packagejson)
|
|
147
|
-
- [`package.json#name`](#packagejsonname)
|
|
148
|
-
- [`package.json#version`](#packagejsonversion)
|
|
149
|
-
- [`package.json#main`](#packagejsonmain)
|
|
150
|
-
- [`package.json#module`](#packagejsonmodule)
|
|
151
|
-
- [`package.json#browser`](#packagejsonbrowser)
|
|
152
|
-
- [`package.json#source`](#packagejsonsource)
|
|
153
|
-
- [`package.json#browserslist`](#packagejsonbrowserslist)
|
|
154
|
-
- [`package.json#engines`](#packagejsonengines)
|
|
155
|
-
- [`package.json#targets`](#packagejsontargets)
|
|
156
|
-
- [`package.json#alias`](#packagejsonalias)
|
|
157
|
-
- [`.parcelrc`](#parcelrc)
|
|
158
|
-
- [Glob maps in `.parcelrc`](#glob-maps-in-parcelrc)
|
|
159
|
-
- [`.parcelrc#extends`](#parcelrcextends)
|
|
160
|
-
- [`.parcelrc#resolvers`](#parcelrcresolvers)
|
|
161
|
-
- [`.parcelrc#transforms`](#parcelrctransforms)
|
|
162
|
-
- [`.parcelrc#bundler`](#parcelrcbundler)
|
|
163
|
-
- [`.parcelrc#namers`](#parcelrcnamers)
|
|
164
|
-
- [`.parcelrc#runtimes`](#parcelrcruntimes)
|
|
165
|
-
- [`.parcelrc#packagers`](#parcelrcpackagers)
|
|
166
|
-
- [`.parcelrc#optimizers`](#parcelrcoptimizers)
|
|
167
|
-
- [`.parcelrc#reporters`](#parcelrcreporters)
|
|
168
|
-
- [`.parcelrc#validators`](#parcelrcvalidators)
|
|
169
|
-
- [Parcel Architecture](#parcel-architecture)
|
|
170
|
-
- [Phases of Parcel](#phases-of-parcel)
|
|
171
|
-
- [Asset Graph](#asset-graph)
|
|
172
|
-
- [Bundles](#bundles)
|
|
173
|
-
- [Sources](#sources)
|
|
174
|
-
- [Targets](#targets)
|
|
175
|
-
- [Target Configuration](#target-configuration)
|
|
176
|
-
- [Environments](#environments)
|
|
177
|
-
- [Caching](#caching)
|
|
178
|
-
- [Asset Resolution](#asset-resolution)
|
|
179
|
-
- [Local Paths](#local-paths)
|
|
180
|
-
- [Package Paths](#package-paths)
|
|
181
|
-
- [URLs](#urls)
|
|
182
|
-
- [Tilde Paths](#tilde-paths)
|
|
183
|
-
- [Aliases](#aliases)
|
|
184
|
-
- [Plugins](#plugins)
|
|
185
|
-
- [Resolvers](#resolvers)
|
|
186
|
-
- [Transforms](#transforms)
|
|
187
|
-
- [Bundlers](#bundlers)
|
|
188
|
-
- [Namers](#namers)
|
|
189
|
-
- [Runtimes](#runtimes)
|
|
190
|
-
- [Packagers](#packagers)
|
|
191
|
-
- [Optimizers](#optimizers)
|
|
192
|
-
- [Reporters](#reporters)
|
|
193
|
-
- [Validators](#validators)
|
|
194
|
-
- [Creating Plugins](#creating-plugins)
|
|
195
|
-
- [Naming](#naming)
|
|
196
|
-
- [Versioning](#versioning)
|
|
197
|
-
- [Engines](#engines)
|
|
198
|
-
- [Plugin APIs](#plugin-apis)
|
|
199
|
-
- [Resolvers](#resolvers-1)
|
|
200
|
-
- [Transforms](#transforms-1)
|
|
201
|
-
- [Bundler](#bundler)
|
|
202
|
-
- [Namers](#namers-1)
|
|
203
|
-
- [Runtimes](#runtimes-1)
|
|
204
|
-
- [Packagers](#packagers-1)
|
|
205
|
-
- [Optimizers](#optimizers-1)
|
|
206
|
-
- [Reporters](#reporters-1)
|
|
207
|
-
- [Validators](#validators-1)
|
|
208
|
-
|
|
209
|
-
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
210
|
-
|
|
211
|
-
## Introduction
|
|
212
|
-
|
|
213
|
-
Parcel is a compiler for all your code, regardless of the language or toolchain.
|
|
214
|
-
|
|
215
|
-
Parcel takes all of your files and dependencies, transforms them, and merges
|
|
216
|
-
them together into a smaller set of output files that can be used to run your
|
|
217
|
-
code.
|
|
218
|
-
|
|
219
|
-
Parcel supports many different languages and file types out of the box, from
|
|
220
|
-
web technologies like HTML, CSS, and JavaScript, to lower level languages like
|
|
221
|
-
Rust, and anything that compiles to WebAssembly (WASM), to assets like images,
|
|
222
|
-
fonts, videos, and more.
|
|
223
|
-
|
|
224
|
-
Parcel makes your code portable, you can build your code for different
|
|
225
|
-
environments, for the web for your server, or for an app. You can even build
|
|
226
|
-
multiple targets at once and have them live update as you make changes.
|
|
227
|
-
|
|
228
|
-
Parcel is fast and predictable. It compiles all of your files in isolation in
|
|
229
|
-
parallel inside workers, caching all of them as it goes along. Caches are
|
|
230
|
-
stable across machines and are only affected by the files and configs within
|
|
231
|
-
your project (unless you want to pass specific environment variables).
|
|
232
|
-
|
|
233
|
-
## Parcel CLI
|
|
234
|
-
|
|
235
|
-
The Parcel CLI is built into the main `parcel` package. While you can install
|
|
236
|
-
it globally and run it, it is much better to install it locally into your
|
|
237
|
-
project as a dev dependency.
|
|
238
|
-
|
|
239
|
-
```sh
|
|
240
|
-
yarn add --dev parcel@next
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
You should also add some "scripts" to your `package.json` to run it easier.
|
|
244
|
-
|
|
245
|
-
```json
|
|
246
|
-
{
|
|
247
|
-
"name": "my-project",
|
|
248
|
-
"scripts": {
|
|
249
|
-
"build": "parcel build index.html",
|
|
250
|
-
"start": "parcel serve index.html"
|
|
251
|
-
},
|
|
252
|
-
"devDependencies": {
|
|
253
|
-
"parcel": "latest"
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
Now you can run `yarn build` to bundle your project for production and
|
|
259
|
-
`yarn start` to dev on your project.
|
|
260
|
-
|
|
261
|
-
### CLI Args & Flags
|
|
262
|
-
|
|
263
|
-
Usage:
|
|
264
|
-
|
|
265
|
-
```sh
|
|
266
|
-
$ parcel [command] [...entries] [...flags]
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
#### `parcel serve`
|
|
270
|
-
|
|
271
|
-
Serve assets on a local server
|
|
272
|
-
|
|
273
|
-
#### `parcel watch`
|
|
274
|
-
|
|
275
|
-
Watch and rebuild code on file changes.
|
|
276
|
-
|
|
277
|
-
#### `parcel build`
|
|
278
|
-
|
|
279
|
-
Build code once, in production mode.
|
|
280
|
-
|
|
281
|
-
#### `[...entries]`
|
|
282
|
-
|
|
283
|
-
Entry files to start bundling, these will be preserved as entry points in the
|
|
284
|
-
output. Defaults to `package.json#source`, falling back to `src/index.*` or
|
|
285
|
-
`index.*`. See [#Entries](#entries-sources-targets-environment).
|
|
286
|
-
|
|
287
|
-
#### `--target [name]`
|
|
288
|
-
|
|
289
|
-
Specifies a specific target to build. If unspecified, Parcel builds all
|
|
290
|
-
targets specified in package.json. See [#Targets](#targets).
|
|
291
|
-
|
|
292
|
-
#### `--open, -o [browser]`
|
|
293
|
-
|
|
294
|
-
Open your local server in a browser. You can optionally pass the name of the
|
|
295
|
-
browser you want to open, otherwise it will use your default browser.
|
|
296
|
-
|
|
297
|
-
#### `--host <host>`
|
|
298
|
-
|
|
299
|
-
Configure the host to serve assets on. The default is to listen on all interfaces.
|
|
300
|
-
|
|
301
|
-
#### `--port <port>, -p`
|
|
302
|
-
|
|
303
|
-
Configure the port to serve assets on. Alternatively you can use the `$PORT`
|
|
304
|
-
environment variable.
|
|
305
|
-
|
|
306
|
-
#### `--https`
|
|
307
|
-
|
|
308
|
-
This will generate a local certificate (which will be untrusted by your
|
|
309
|
-
browser, you'll need to approve it) and serve your assets over `https://`
|
|
310
|
-
|
|
311
|
-
##### `--cert <path>`
|
|
312
|
-
|
|
313
|
-
Specify the filepath to your SSL certificate when using `--https`.
|
|
314
|
-
|
|
315
|
-
##### `--key <path>`
|
|
316
|
-
|
|
317
|
-
Specify the filepath to your SSL key when using `--https`.
|
|
318
|
-
|
|
319
|
-
#### `--cache-dir <dir>`, `--no-cache`
|
|
320
|
-
|
|
321
|
-
Configure the cache directory with `--cache <dir>` or disable it altogether
|
|
322
|
-
with `--no-cache`.
|
|
323
|
-
|
|
324
|
-
#### `--hot`, `--no-hot`
|
|
325
|
-
|
|
326
|
-
Turn hot reloading on or off.
|
|
327
|
-
|
|
328
|
-
##### `--hot-host <hostname>`
|
|
329
|
-
|
|
330
|
-
Configure the hot reloading hostname.
|
|
331
|
-
|
|
332
|
-
##### `--hot-port <port>`
|
|
333
|
-
|
|
334
|
-
Configure the hot reloading port.
|
|
335
|
-
|
|
336
|
-
#### `--[no-]source-maps`
|
|
337
|
-
|
|
338
|
-
Turn source maps on or off. Source maps are turned on by default.
|
|
339
|
-
|
|
340
|
-
#### `--autoinstall [npm/yarn], --no-autoinstall`
|
|
341
|
-
|
|
342
|
-
When enabled, whenever Parcel discovers a dependency that isn't installed it
|
|
343
|
-
will attempt to install it with either npm or Yarn (defaults to npm unless a
|
|
344
|
-
`yarn.lock` exists).
|
|
345
|
-
|
|
346
|
-
#### `--log-level <level>`
|
|
347
|
-
|
|
348
|
-
Set the log level, either either "none", "error", "warn", "info", or "verbose".
|
|
349
|
-
The default is "info".
|
|
350
|
-
|
|
351
|
-
#### `--version, -v, -V`
|
|
352
|
-
|
|
353
|
-
Return the current version of Parcel.
|
|
354
|
-
|
|
355
|
-
#### `--help, -h`
|
|
356
|
-
|
|
357
|
-
Get help with the CLI.
|
|
358
|
-
|
|
359
|
-
## Parcel Config
|
|
360
|
-
|
|
361
|
-
Parcel has always and will always work out of the box for many projects with
|
|
362
|
-
zero configuration. It should always be extremely simple to get started. But if
|
|
363
|
-
you do want more control, we give you the tools to do so.
|
|
364
|
-
|
|
365
|
-
### Configuring external tools
|
|
366
|
-
|
|
367
|
-
A huge part of what Parcel does is run other tools over your code. Instead of
|
|
368
|
-
pulling all that configuration into Parcel, we make use of their own
|
|
369
|
-
configuration systems. So if you're using Babel, you should just use `.babelrc`
|
|
370
|
-
files to configure it.
|
|
371
|
-
|
|
372
|
-
When we do need to introduce config, we create tool specific config files in
|
|
373
|
-
order to do so.
|
|
374
|
-
|
|
375
|
-
### Configuring Parcel
|
|
376
|
-
|
|
377
|
-
When you do need to configure Parcel, it will be in one of 3 places.
|
|
378
|
-
|
|
379
|
-
- If you need to configure the CLI, it will be a CLI flag
|
|
380
|
-
- If you need to configure your package, it will be in the `package.json`
|
|
381
|
-
- If you need to configure something with your files or the Parcel asset
|
|
382
|
-
pipeline, it will be in `.parcelrc`
|
|
383
|
-
|
|
384
|
-
### `package.json`
|
|
385
|
-
|
|
386
|
-
[todo]
|
|
387
|
-
|
|
388
|
-
```json
|
|
389
|
-
{
|
|
390
|
-
"name": "foo",
|
|
391
|
-
"main": "dist/main/index.js",
|
|
392
|
-
"module": "dist/module/index.js",
|
|
393
|
-
"browser": "dist/browser/index.js",
|
|
394
|
-
"browserslist": ["> 1%", "not dead"],
|
|
395
|
-
"engines": {
|
|
396
|
-
"node": ">=4.x"
|
|
397
|
-
},
|
|
398
|
-
"source": "src/index.js",
|
|
399
|
-
"targets": {
|
|
400
|
-
"main": {
|
|
401
|
-
"node": ["^4.0.0"]
|
|
402
|
-
},
|
|
403
|
-
"module": {
|
|
404
|
-
"node": ["^8.0.0"]
|
|
405
|
-
},
|
|
406
|
-
"browser": {
|
|
407
|
-
"browsers": ["> 1%", "not dead"]
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
"alias": {
|
|
411
|
-
"react": "preact-compat",
|
|
412
|
-
"react-dom": "preact-compat"
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
#### `package.json#name`
|
|
418
|
-
|
|
419
|
-
**(Required)** The name of the package is always required in order to be
|
|
420
|
-
considered a valid `package.json`.
|
|
421
|
-
|
|
422
|
-
```json
|
|
423
|
-
{
|
|
424
|
-
"name": "my-package"
|
|
425
|
-
}
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
#### `package.json#version`
|
|
429
|
-
|
|
430
|
-
**(Required)** All packages inside `node_modules` must have a `package.json#version`.
|
|
431
|
-
|
|
432
|
-
```json
|
|
433
|
-
{
|
|
434
|
-
"version": "1.0.0"
|
|
435
|
-
}
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
#### `package.json#main`
|
|
439
|
-
|
|
440
|
-
This is the "main" target's entry point for the package, by default in library mode (doesn't bundle dependencies).
|
|
441
|
-
|
|
442
|
-
```json
|
|
443
|
-
{
|
|
444
|
-
"main": "dist/main/index.js"
|
|
445
|
-
}
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
See [Targets](#targets)
|
|
449
|
-
|
|
450
|
-
#### `package.json#module`
|
|
451
|
-
|
|
452
|
-
This is the "module" target's entry point for the package, by default in library mode (doesn't bundle dependencies).
|
|
453
|
-
|
|
454
|
-
```json
|
|
455
|
-
{
|
|
456
|
-
"module": "dist/module/index.js"
|
|
457
|
-
}
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
See [Targets](#targets)
|
|
461
|
-
|
|
462
|
-
#### `package.json#browser`
|
|
463
|
-
|
|
464
|
-
This is the "browser" target's entry point for the package, by default in library mode (doesn't bundle dependencies).
|
|
465
|
-
|
|
466
|
-
```json
|
|
467
|
-
{
|
|
468
|
-
"browser": "dist/browser/index.js"
|
|
469
|
-
}
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
See [Targets](#targets)
|
|
473
|
-
|
|
474
|
-
#### `package.json#source`
|
|
475
|
-
|
|
476
|
-
Specify the entry points for your source code which gets mapped to your
|
|
477
|
-
targets.
|
|
478
|
-
|
|
479
|
-
```json
|
|
480
|
-
{
|
|
481
|
-
"source": "src/index.js",
|
|
482
|
-
"source": ["src/index.js", "src/index.html"]
|
|
483
|
-
}
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
See [Sources](#sources)
|
|
487
|
-
|
|
488
|
-
#### `package.json#browserslist`
|
|
489
|
-
|
|
490
|
-
As specified by Browserslist, this field is for specifying which transforms
|
|
491
|
-
should be applied to browser bundles.
|
|
492
|
-
|
|
493
|
-
```json
|
|
494
|
-
{
|
|
495
|
-
"browserslist": ["> 0.2%", "not dead"]
|
|
496
|
-
}
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
See [Environments](#environments)
|
|
500
|
-
|
|
501
|
-
#### `package.json#engines`
|
|
502
|
-
|
|
503
|
-
Specify what versions of what engines you want to support.
|
|
504
|
-
|
|
505
|
-
```json
|
|
506
|
-
{
|
|
507
|
-
"engines": {
|
|
508
|
-
"node": ">=4.x",
|
|
509
|
-
"electron": ">=2.x"
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
See [Environments](#environments)
|
|
515
|
-
|
|
516
|
-
#### `package.json#targets`
|
|
517
|
-
|
|
518
|
-
Configuration for individual targets.
|
|
519
|
-
|
|
520
|
-
```json
|
|
521
|
-
{
|
|
522
|
-
"targets": {
|
|
523
|
-
"main": {
|
|
524
|
-
"engines": {
|
|
525
|
-
"node": ">=4.x",
|
|
526
|
-
"electron": ">=2.x"
|
|
527
|
-
},
|
|
528
|
-
},
|
|
529
|
-
"browser": {
|
|
530
|
-
"engines": {
|
|
531
|
-
"browsers": ["> 1%", "not dead"]
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
```
|
|
537
|
-
|
|
538
|
-
See [Targets](#targets)
|
|
539
|
-
|
|
540
|
-
#### `package.json#alias`
|
|
541
|
-
|
|
542
|
-
Aliases asset names/paths to other assets.
|
|
543
|
-
|
|
544
|
-
```json
|
|
545
|
-
{
|
|
546
|
-
"alias": {
|
|
547
|
-
"react": "preact-compat",
|
|
548
|
-
"react-dom": "preact-compat"
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
See [Aliases](#aliases)
|
|
554
|
-
|
|
555
|
-
### `.parcelrc`
|
|
556
|
-
|
|
557
|
-
Your `.parcelrc` file will likely contain just a few fields (if you have one at
|
|
558
|
-
all), but here's an example of a `.parcelrc` file that contains every field:
|
|
559
|
-
|
|
560
|
-
```json
|
|
561
|
-
{
|
|
562
|
-
"extends": ["@parcel/config-default"],
|
|
563
|
-
"resolvers": ["@parcel/resolver-default"],
|
|
564
|
-
"transforms": {
|
|
565
|
-
"*.vue": ["@parcel/transformer-vue"],
|
|
566
|
-
"*.scss": ["@parcel/transformer-sass"],
|
|
567
|
-
"*.js": ["@parcel/transformer-babel"],
|
|
568
|
-
"*.css": ["@parcel/transformer-postcss"],
|
|
569
|
-
"*.html": ["@parcel/transformer-posthtml"]
|
|
570
|
-
},
|
|
571
|
-
"bundler": "@parcel/bundler-default",
|
|
572
|
-
"namers": ["@parcel/namer-default"],
|
|
573
|
-
"runtimes": {
|
|
574
|
-
"browser": ["@parcel/runtime-js", "@parcel/runtime-browser-hmr"],
|
|
575
|
-
"node": ["@parcel/runtime-js"]
|
|
576
|
-
},
|
|
577
|
-
"packagers": {
|
|
578
|
-
"*.js": "@parcel/packager-js",
|
|
579
|
-
"*.css": "@parcel/packager-css",
|
|
580
|
-
"*.html": "@parcel/packager-html",
|
|
581
|
-
"*.wasm": "@parcel/packager-wasm",
|
|
582
|
-
"*.raw": "@parcel/packager-raw"
|
|
583
|
-
},
|
|
584
|
-
"optimizers": {
|
|
585
|
-
"*.js": ["@parcel/optimizer-uglify"],
|
|
586
|
-
"*.css": ["@parcel/optimizer-cssnano"],
|
|
587
|
-
"*.html": ["@parcel/optimizer-htmlnano"],
|
|
588
|
-
"*.{png,jpg,jpeg,svg,...}": ["@parcel/optimizer-imagemin"]
|
|
589
|
-
},
|
|
590
|
-
"reporters": ["@parcel/reporter-cli"]
|
|
591
|
-
}
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
#### Glob maps in `.parcelrc`
|
|
595
|
-
|
|
596
|
-
Many config properties like `transforms` or `packagers` use objects as maps of
|
|
597
|
-
globs to package names. While objects in JSON are technically unordered, Parcel
|
|
598
|
-
does use the order to give globs priority when a file name is being tested
|
|
599
|
-
against them.
|
|
600
|
-
|
|
601
|
-
```json
|
|
602
|
-
{
|
|
603
|
-
"transforms": {
|
|
604
|
-
"icons/*.svg": ["highest-priority"],
|
|
605
|
-
"*.svg": ["lowest-priority"]
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
Here if we are trying to find a transform for the file `icons/home.svg`, we'll
|
|
611
|
-
work our way down the globs until we find a match, which would be
|
|
612
|
-
`icons/*.svg`, we never reach `*.svg`.
|
|
613
|
-
|
|
614
|
-
#### `.parcelrc#extends`
|
|
615
|
-
|
|
616
|
-
`extends` can either be a string or an array of strings that specify base
|
|
617
|
-
configs to extend. That base configuration can be the path to another
|
|
618
|
-
`.parcelrc` file or the name of a Parcel config package.
|
|
619
|
-
|
|
620
|
-
```json
|
|
621
|
-
{
|
|
622
|
-
"extends": "@parcel/config-default",
|
|
623
|
-
"extends": "../.parcelrc",
|
|
624
|
-
"extends": ["@parcel/config-default", "@company/parcel-config"]
|
|
625
|
-
}
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
When extending a config, Parcel does a shallow merge of the two configs.
|
|
629
|
-
|
|
630
|
-
#### `.parcelrc#resolvers`
|
|
631
|
-
|
|
632
|
-
`resolvers` is an array of strings that specifies the name of a Parcel resolver
|
|
633
|
-
package.
|
|
634
|
-
|
|
635
|
-
```json
|
|
636
|
-
{
|
|
637
|
-
"resolvers": ["@parcel/resolver-default"]
|
|
638
|
-
}
|
|
639
|
-
```
|
|
640
|
-
|
|
641
|
-
See [Resolvers](#resolvers)
|
|
642
|
-
|
|
643
|
-
#### `.parcelrc#transforms`
|
|
644
|
-
|
|
645
|
-
`transforms` is an object map of globs to arrays of Parcel transform packages.
|
|
646
|
-
|
|
647
|
-
```json
|
|
648
|
-
{
|
|
649
|
-
"transforms": {
|
|
650
|
-
"*.js": ["@parcel/transformer-babel"]
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
```
|
|
654
|
-
|
|
655
|
-
See [Transforms](#transforms)
|
|
656
|
-
|
|
657
|
-
#### `.parcelrc#bundler`
|
|
658
|
-
|
|
659
|
-
`bundler` is a string that specifies the name of a Parcel bundler package.
|
|
660
|
-
|
|
661
|
-
```json
|
|
662
|
-
{
|
|
663
|
-
"bundler": "@parcel/bundler-default"
|
|
664
|
-
}
|
|
665
|
-
```
|
|
666
|
-
|
|
667
|
-
See [Bundlers](#bundlers)
|
|
668
|
-
|
|
669
|
-
#### `.parcelrc#namers`
|
|
670
|
-
|
|
671
|
-
`bundler` is an array of Parcel namer packages.
|
|
672
|
-
|
|
673
|
-
```json
|
|
674
|
-
{
|
|
675
|
-
"namers": ["@parcel/namer-default"]
|
|
676
|
-
}
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
See [Namers](#namers)
|
|
680
|
-
|
|
681
|
-
#### `.parcelrc#runtimes`
|
|
682
|
-
|
|
683
|
-
`runtimes` is an object map of environments to arrays of Parcel runtime packages.
|
|
684
|
-
|
|
685
|
-
```json
|
|
686
|
-
{
|
|
687
|
-
"runtimes": {
|
|
688
|
-
"browser": ["@parcel/runtime-js", "@parcel/runtime-browser-hmr"],
|
|
689
|
-
"node": ["@parcel/runtime-js"]
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
See [Runtimes](#runtimes)
|
|
695
|
-
|
|
696
|
-
#### `.parcelrc#packagers`
|
|
697
|
-
|
|
698
|
-
`packagers` is an object map of globs to Parcel packager packages.
|
|
699
|
-
|
|
700
|
-
```json
|
|
701
|
-
{
|
|
702
|
-
"packagers": {
|
|
703
|
-
"*.js": ["@parcel/packager-js"]
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
```
|
|
707
|
-
|
|
708
|
-
See [Packagers](#packagers)
|
|
709
|
-
|
|
710
|
-
#### `.parcelrc#optimizers`
|
|
711
|
-
|
|
712
|
-
`optimizers` is an object map of globs to arrays of Parcel optimizer packages.
|
|
713
|
-
|
|
714
|
-
```json
|
|
715
|
-
{
|
|
716
|
-
"optimizers": {
|
|
717
|
-
"*.js": ["@parcel/optimizer-uglify"]
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
```
|
|
721
|
-
|
|
722
|
-
See [Optimizers](#optimizers)
|
|
723
|
-
|
|
724
|
-
#### `.parcelrc#reporters`
|
|
725
|
-
|
|
726
|
-
`reporters` is an array of Parcel reporter packages.
|
|
727
|
-
|
|
728
|
-
```json
|
|
729
|
-
{
|
|
730
|
-
"reporters": ["@parcel/reporter-detailed"]
|
|
731
|
-
}
|
|
732
|
-
```
|
|
733
|
-
|
|
734
|
-
See [Reporters](#reporters).
|
|
735
|
-
|
|
736
|
-
#### `.parcelrc#validators`
|
|
737
|
-
|
|
738
|
-
`validators` is an object map of globs to arrays of Parcel validator packages.
|
|
739
|
-
|
|
740
|
-
```json
|
|
741
|
-
|
|
742
|
-
"validators": {
|
|
743
|
-
"*.ts": ["@parcel/validator-typescript"]
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
```
|
|
747
|
-
|
|
748
|
-
See [Reporters](#validators).
|
|
749
|
-
|
|
750
|
-
## Parcel Architecture
|
|
751
|
-
|
|
752
|
-
Even if you aren't doing anything that complex, if you are going to use Parcel
|
|
753
|
-
a lot it makes sense to take some time and understand how it works.
|
|
754
|
-
|
|
755
|
-
### Phases of Parcel
|
|
756
|
-
|
|
757
|
-
At a high level Parcel runs through several phases:
|
|
758
|
-
|
|
759
|
-
- Resolving
|
|
760
|
-
- Transforming
|
|
761
|
-
- Bundling
|
|
762
|
-
- Packaging
|
|
763
|
-
- Optimizing
|
|
764
|
-
- (Validating)
|
|
765
|
-
|
|
766
|
-
The **resolving** and **transforming** phases work together in parallel to
|
|
767
|
-
build a graph of all your assets.
|
|
768
|
-
|
|
769
|
-
This asset graph gets translated into bundles in the **bundling** phase.
|
|
770
|
-
|
|
771
|
-
Then the **packaging** phase takes the assets in the calculated bundles and
|
|
772
|
-
merges them together into files each containing an entire bundle.
|
|
773
|
-
|
|
774
|
-
Finally, in the **optimizing** phase, Parcel takes these bundles files and runs
|
|
775
|
-
them through optimizing transforms.
|
|
776
|
-
|
|
777
|
-
### Asset Graph
|
|
778
|
-
|
|
779
|
-
During the resolving and transforming phases, Parcel discovers all the assets
|
|
780
|
-
in your app or program. Every asset can have it's own dependencies on other
|
|
781
|
-
assets which Parcel will pull in.
|
|
782
|
-
|
|
783
|
-
The data structure that represents all of these assets and their dependencies
|
|
784
|
-
on one another is known as "The Asset Graph".
|
|
785
|
-
|
|
786
|
-
| Asset Name | Dependencies |
|
|
787
|
-
| ------------ | ------------------- |
|
|
788
|
-
| `index.html` | `app.css`, `app.js` |
|
|
789
|
-
| `app.css` | N/A |
|
|
790
|
-
| `app.js` | `navbar.js` |
|
|
791
|
-
| `navbar.js` | etc. |
|
|
792
|
-
|
|
793
|
-
### Bundles
|
|
794
|
-
|
|
795
|
-
Once Parcel has built the entire Asset Graph, it begins turning it into
|
|
796
|
-
"bundles". These bundles are groupings of assets that get placed together in a
|
|
797
|
-
single file.
|
|
798
|
-
|
|
799
|
-
Bundles will (generally) contain only assets in the same language:
|
|
800
|
-
|
|
801
|
-
| Bundle Name | Assets |
|
|
802
|
-
| ------------ | --------------------------- |
|
|
803
|
-
| `index.html` | `index.html` |
|
|
804
|
-
| `app.css` | `app.css` |
|
|
805
|
-
| `app.js` | `app.js`, `navbar.js`, etc. |
|
|
806
|
-
|
|
807
|
-
Some assets are considered "entry" points into your app, and will stay as
|
|
808
|
-
separate bundles. For example, if your `index.html` file links to an
|
|
809
|
-
`about.html` file, they won't be merged together.
|
|
810
|
-
|
|
811
|
-
| Bundle Name | Assets | Entry URL |
|
|
812
|
-
| ------------ | ------------ | --------- |
|
|
813
|
-
| `index.html` | `index.html` | `/` |
|
|
814
|
-
| `about.html` | `about.html` | `/about` |
|
|
815
|
-
|
|
816
|
-
### Sources
|
|
817
|
-
|
|
818
|
-
"Sources" are the files that contain the source code to your app before being
|
|
819
|
-
compiled by Parcel.
|
|
820
|
-
|
|
821
|
-
Parcel discovers these sources by following their dependencies on one another
|
|
822
|
-
starting at your "entries".
|
|
823
|
-
|
|
824
|
-
These entries will be one of:
|
|
825
|
-
|
|
826
|
-
1. `$ parcel <...entries>`
|
|
827
|
-
2. `~/package.json#source`
|
|
828
|
-
3. `./src/index.*`
|
|
829
|
-
4. `./index.*`
|
|
830
|
-
|
|
831
|
-
From there, everything those assets depend on will be considered a "source" in
|
|
832
|
-
Parcel.
|
|
833
|
-
|
|
834
|
-
### Targets
|
|
835
|
-
|
|
836
|
-
When Parcel runs, it can build your asset graph in multiple different ways
|
|
837
|
-
simultaneously. These are called "targets".
|
|
838
|
-
|
|
839
|
-
For example, you could have a "modern" target that _targets_ newer browsers
|
|
840
|
-
and a "legacy" target for older browsers.
|
|
841
|
-
|
|
842
|
-
Sources get mapped to targets,
|
|
843
|
-
|
|
844
|
-
#### Target Configuration
|
|
845
|
-
|
|
846
|
-
In the most explicit form, targets are configured via the
|
|
847
|
-
`package.json#targets` field.
|
|
848
|
-
|
|
849
|
-
```js
|
|
850
|
-
{
|
|
851
|
-
"app": "dist/browser/index.js",
|
|
852
|
-
"appModern": "dist/browserModern/index.js",
|
|
853
|
-
"targets": {
|
|
854
|
-
"app": { /* target env */ },
|
|
855
|
-
"appModern": { /* target env */ }
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
```
|
|
859
|
-
|
|
860
|
-
Each target has a name which corresponds to a top-level `package.json` field
|
|
861
|
-
such as `package.json#main` or `package.json#browser` which specify the primary
|
|
862
|
-
entry point for that target.
|
|
863
|
-
|
|
864
|
-
Inside each of those targets contains the target's environment configuration:
|
|
865
|
-
|
|
866
|
-
| Option | Possible values | Description |
|
|
867
|
-
| -------------------- | --------------- | ----------- |
|
|
868
|
-
| `context` | `'node' \| 'browser' \| 'web-worker' \| 'electron-main' \| 'electron-renderer'` | Where the bundle should run |
|
|
869
|
-
| `includeNodeModules` | `boolean \| [String]` | Whether to bundle all/none/some `node_module` dependency |
|
|
870
|
-
| `outputFormat` | `'global' \| 'esmodule' \| 'commonjs'` | Which type of imports/exports should be emitted|
|
|
871
|
-
| `publicUrl` | `string` | The public url of the bundle at runtime |
|
|
872
|
-
| `isLibrary` | `boolean` | Library as in 'npm library' |
|
|
873
|
-
| `sourceMap` | `boolean \| {inlineSources?: boolean, sourceRoot?: string, inline?: boolean}` | Enable/disable sourcemap and set options
|
|
874
|
-
| `engines` | Engines | Same as `package.json#engines` |
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
However, a lot of the normal configuration you might want will already have
|
|
878
|
-
defaults provided for you:
|
|
879
|
-
|
|
880
|
-
```cs
|
|
881
|
-
targets = {
|
|
882
|
-
main: {
|
|
883
|
-
engines: {
|
|
884
|
-
node: value("package.json#engines.node"),
|
|
885
|
-
browsers: unless exists("package.json#browser") then value("package.json#browserlist")
|
|
886
|
-
},
|
|
887
|
-
isLibrary: true
|
|
888
|
-
},
|
|
889
|
-
module: {
|
|
890
|
-
engines: {
|
|
891
|
-
node: value("package.json#engines.node"),
|
|
892
|
-
browsers: unless exists("package.json#browser") then value("package.json#browserlist")
|
|
893
|
-
},
|
|
894
|
-
isLibrary: true
|
|
895
|
-
},
|
|
896
|
-
browser: {
|
|
897
|
-
engines: {
|
|
898
|
-
browsers: value("package.json#browserslist")
|
|
899
|
-
},
|
|
900
|
-
isLibrary: true
|
|
901
|
-
},
|
|
902
|
-
...value("package.json#targets"),
|
|
903
|
-
}
|
|
904
|
-
```
|
|
905
|
-
|
|
906
|
-
### Environments
|
|
907
|
-
|
|
908
|
-
Environments tell Parcel how to transform and bundle each asset. They tell
|
|
909
|
-
Parcel if an asset is going to be run in a browser or in NodeJS/Electron.
|
|
910
|
-
|
|
911
|
-
They also tell Parcel's transform plugins how they should run. They tell
|
|
912
|
-
[Babel](http://babeljs.io/docs/en/babel-preset-env#targetsbrowsers) or
|
|
913
|
-
[Autoprefixer](https://github.com/postcss/autoprefixer#browsers) what browsers
|
|
914
|
-
your asset is targetting.
|
|
915
|
-
|
|
916
|
-
You can configure environments through your targets.
|
|
917
|
-
|
|
918
|
-
```json
|
|
919
|
-
{
|
|
920
|
-
"targets": {
|
|
921
|
-
"main": {
|
|
922
|
-
"engines": {
|
|
923
|
-
"node": ">=4.x",
|
|
924
|
-
"electron": ">=2.x",
|
|
925
|
-
"browsers": ["> 1%", "not dead"]
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
```
|
|
931
|
-
|
|
932
|
-
When one asset depends on another, the environment is inherited from its
|
|
933
|
-
parent. But how you depend on the asset can change some properties of that
|
|
934
|
-
environment.
|
|
935
|
-
|
|
936
|
-
For example:
|
|
937
|
-
|
|
938
|
-
```js
|
|
939
|
-
navigator.serviceWorker.register('./service-worker.js');
|
|
940
|
-
```
|
|
941
|
-
|
|
942
|
-
```js
|
|
943
|
-
let childEnvironment = {...parentEnvironment, browserContext: 'service-worker'};
|
|
944
|
-
```
|
|
945
|
-
|
|
946
|
-
### Caching
|
|
947
|
-
|
|
948
|
-
Parcel will create a `/node_modules/.cache/parcel` directory
|
|
949
|
-
|
|
950
|
-
The top-level directory will be filled with directories with two letters, which
|
|
951
|
-
are the start of a hash which is finished by the names of the JSON files inside.
|
|
952
|
-
|
|
953
|
-
```
|
|
954
|
-
/node_modules/.cache/parcel/
|
|
955
|
-
/00/
|
|
956
|
-
213debd8ddd45819b79a3a974ed487.json
|
|
957
|
-
40ae9b581afc53841307a4b3c2463d.json
|
|
958
|
-
63a9dd58fc1e8f8bb819759ea9793c.json
|
|
959
|
-
...
|
|
960
|
-
/01/
|
|
961
|
-
/../
|
|
962
|
-
/zy/
|
|
963
|
-
/zz/
|
|
964
|
-
```
|
|
965
|
-
|
|
966
|
-
It follows this weird structure in order to avoid too many files being created
|
|
967
|
-
in a single directory which degrades file system performance.
|
|
968
|
-
|
|
969
|
-
## Asset Resolution
|
|
970
|
-
|
|
971
|
-
Parcel follows the Node module resolution algorithm with a few additions.
|
|
972
|
-
|
|
973
|
-
### Local Paths
|
|
974
|
-
|
|
975
|
-
```
|
|
976
|
-
./path/to/file
|
|
977
|
-
./path/to/file.js
|
|
978
|
-
```
|
|
979
|
-
|
|
980
|
-
These follow the [Node module resolution algorithm](https://nodejs.org/api/modules.html#modules_all_together).
|
|
981
|
-
|
|
982
|
-
### Package Paths
|
|
983
|
-
|
|
984
|
-
```
|
|
985
|
-
preact
|
|
986
|
-
lodash/cloneDeep
|
|
987
|
-
@sindresorhus/is
|
|
988
|
-
```
|
|
989
|
-
|
|
990
|
-
These follow the [Node module resolution algorithm](https://nodejs.org/api/modules.html#modules_all_together).
|
|
991
|
-
|
|
992
|
-
### URLs
|
|
993
|
-
|
|
994
|
-
```
|
|
995
|
-
https://unpkg.com/preact@8.2.9/dist/preact.min.js
|
|
996
|
-
```
|
|
997
|
-
|
|
998
|
-
Parcel by default will ignore URL dependencies, other resolver plugins may
|
|
999
|
-
choose to do something with them.
|
|
1000
|
-
|
|
1001
|
-
### Tilde Paths
|
|
1002
|
-
|
|
1003
|
-
```
|
|
1004
|
-
~/src/file.js
|
|
1005
|
-
```
|
|
1006
|
-
|
|
1007
|
-
Only when used outside of `node_modules` directories, the `~` is replaced by an
|
|
1008
|
-
absolute path to the closest package root:
|
|
1009
|
-
|
|
1010
|
-
```sh
|
|
1011
|
-
/path/to/app #(/package.json)
|
|
1012
|
-
```
|
|
1013
|
-
|
|
1014
|
-
To form a path that looks like:
|
|
1015
|
-
|
|
1016
|
-
```
|
|
1017
|
-
/path/to/app/src/file.js
|
|
1018
|
-
```
|
|
1019
|
-
|
|
1020
|
-
Then it follows the [Node module resolution algorithm](https://nodejs.org/api/modules.html#modules_all_together).
|
|
1021
|
-
|
|
1022
|
-
### Aliases
|
|
1023
|
-
|
|
1024
|
-
Aliases come in two forms:
|
|
1025
|
-
|
|
1026
|
-
1. Package Aliases: `react -> preact`
|
|
1027
|
-
2. File/Directory Aliases: `utils` -> `./src/utils`
|
|
1028
|
-
|
|
1029
|
-
```json
|
|
1030
|
-
{
|
|
1031
|
-
"name": "my-project",
|
|
1032
|
-
"alias": {
|
|
1033
|
-
"react": "preact-compat",
|
|
1034
|
-
"react-dom": "preact-compat",
|
|
1035
|
-
"utils": "./src/utils",
|
|
1036
|
-
"components": "./src/components"
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
```
|
|
1040
|
-
|
|
1041
|
-
There are a couple of rules:
|
|
1042
|
-
|
|
1043
|
-
1. Aliases will only be respected when specified outside of `node_modules`.
|
|
1044
|
-
2. Aliases specified outside of `node_modules` will affect assets inside of `node_modules`.
|
|
1045
|
-
3. Aliases cannot build off of other aliases.
|
|
1046
|
-
4. Only one alias will be applied at a time.
|
|
1047
|
-
5. Aliases must be valid npm package names.
|
|
1048
|
-
|
|
1049
|
-
## Plugins
|
|
1050
|
-
|
|
1051
|
-
### Resolvers
|
|
1052
|
-
|
|
1053
|
-
When one asset depends on another through an asset specifier, the resolver is
|
|
1054
|
-
responsible for determining what asset is being requested.
|
|
1055
|
-
|
|
1056
|
-
See [Asset Resolution](#asset-resolution) for more details.
|
|
1057
|
-
|
|
1058
|
-
```json
|
|
1059
|
-
{
|
|
1060
|
-
"resolvers": ["@parcel/resolver-v1"]
|
|
1061
|
-
}
|
|
1062
|
-
```
|
|
1063
|
-
|
|
1064
|
-
**Official Resolvers:**
|
|
1065
|
-
|
|
1066
|
-
- `@parcel/resolver-v1`
|
|
1067
|
-
|
|
1068
|
-
### Transforms
|
|
1069
|
-
|
|
1070
|
-
Transforms _transform_ single assets as they are discovered and added to the
|
|
1071
|
-
asset graph. They mostly call out to different compilers and preprocessors.
|
|
1072
|
-
|
|
1073
|
-
```json
|
|
1074
|
-
{
|
|
1075
|
-
"transforms": {
|
|
1076
|
-
"*.js": ["@parcel/transformer-babel"]
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
```
|
|
1080
|
-
|
|
1081
|
-
**Official Transforms:**
|
|
1082
|
-
|
|
1083
|
-
- `@parcel/transformer-babel`
|
|
1084
|
-
- `@parcel/transformer-coffeescript`
|
|
1085
|
-
- `@parcel/transformer-graphql`
|
|
1086
|
-
- `@parcel/transformer-json`
|
|
1087
|
-
- `@parcel/transformer-json5`
|
|
1088
|
-
- `@parcel/transformer-less`
|
|
1089
|
-
- `@parcel/transformer-posthtml`
|
|
1090
|
-
- `@parcel/transformer-postcss`
|
|
1091
|
-
- `@parcel/transformer-pug`
|
|
1092
|
-
- `@parcel/transformer-raw`
|
|
1093
|
-
- `@parcel/transformer-reason`
|
|
1094
|
-
- `@parcel/transformer-rust`
|
|
1095
|
-
- `@parcel/transformer-stylus`
|
|
1096
|
-
- `@parcel/transformer-toml`
|
|
1097
|
-
- `@parcel/transformer-typescript`
|
|
1098
|
-
- `@parcel/transformer-vue`
|
|
1099
|
-
- `@parcel/transformer-wasm`
|
|
1100
|
-
- `@parcel/transformer-webmanifest`
|
|
1101
|
-
- `@parcel/transformer-yaml`
|
|
1102
|
-
- ...
|
|
1103
|
-
|
|
1104
|
-
### Bundlers
|
|
1105
|
-
|
|
1106
|
-
Bundlers accept the entire asset graph and turn it into sets of bundles.
|
|
1107
|
-
|
|
1108
|
-
```json
|
|
1109
|
-
{
|
|
1110
|
-
"bundler": "@parcel/bundler-default"
|
|
1111
|
-
}
|
|
1112
|
-
```
|
|
1113
|
-
|
|
1114
|
-
**Official Bundlers:**
|
|
1115
|
-
|
|
1116
|
-
- `@parcel/bundler-default`
|
|
1117
|
-
|
|
1118
|
-
### Namers
|
|
1119
|
-
|
|
1120
|
-
Namers accept a bundle and return a filename for that bundle.
|
|
1121
|
-
|
|
1122
|
-
```json
|
|
1123
|
-
{
|
|
1124
|
-
"namers": ["@parcel/namer-default"]
|
|
1125
|
-
}
|
|
1126
|
-
```
|
|
1127
|
-
|
|
1128
|
-
**Official Namers:**
|
|
1129
|
-
|
|
1130
|
-
- `@parcel/namer-default`
|
|
1131
|
-
|
|
1132
|
-
### Runtimes
|
|
1133
|
-
|
|
1134
|
-
Runtimes get called after the bundler phase and generate an asset which gets
|
|
1135
|
-
included in the final bundle.
|
|
1136
|
-
|
|
1137
|
-
```json
|
|
1138
|
-
{
|
|
1139
|
-
"runtimes": {
|
|
1140
|
-
"browser": ["@parcel/runtime-js", "@parcel/runtime-browser-hmr"],
|
|
1141
|
-
"node": ["@parcel/runtime-js"]
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
```
|
|
1145
|
-
|
|
1146
|
-
**Official Runtimes:**
|
|
1147
|
-
|
|
1148
|
-
- `@parcel/runtime-js`
|
|
1149
|
-
- `@parcel/runtime-hmr`
|
|
1150
|
-
|
|
1151
|
-
### Packagers
|
|
1152
|
-
|
|
1153
|
-
Packagers determine how to merge different asset types into a single bundle.
|
|
1154
|
-
|
|
1155
|
-
```json
|
|
1156
|
-
{
|
|
1157
|
-
"packagers": {
|
|
1158
|
-
"*.css": "@parcel/packager-css"
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
```
|
|
1162
|
-
|
|
1163
|
-
**Official Packagers:**
|
|
1164
|
-
|
|
1165
|
-
- `@parcel/packager-html`
|
|
1166
|
-
- `@parcel/packager-js`
|
|
1167
|
-
- `@parcel/packager-css`
|
|
1168
|
-
- `@parcel/packager-wasm`
|
|
1169
|
-
- `@parcel/packager-raw`
|
|
1170
|
-
|
|
1171
|
-
### Optimizers
|
|
1172
|
-
|
|
1173
|
-
Optimizers are similar to transformers, but they accept a bundle instead
|
|
1174
|
-
of a single asset.
|
|
1175
|
-
|
|
1176
|
-
```json
|
|
1177
|
-
{
|
|
1178
|
-
"optimizers": {
|
|
1179
|
-
"*.js": ["@parcel/optimizer-terser"],
|
|
1180
|
-
"*.css": ["@parcel/optimizer-csso"]
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
```
|
|
1184
|
-
|
|
1185
|
-
**Official Optimizers:**
|
|
1186
|
-
|
|
1187
|
-
- `@parcel/packager-terser`
|
|
1188
|
-
- `@parcel/packager-csso`
|
|
1189
|
-
- [todo]
|
|
1190
|
-
|
|
1191
|
-
### Reporters
|
|
1192
|
-
|
|
1193
|
-
Reporters receive events as they happen and can either use the Parcel logger to
|
|
1194
|
-
output to stdout/stderr or they can return assets to be generated on the file
|
|
1195
|
-
system.
|
|
1196
|
-
|
|
1197
|
-
```json
|
|
1198
|
-
{
|
|
1199
|
-
"reporters": ["@parcel/reporter-cli", "@parcel/reporter-dev-server"]
|
|
1200
|
-
}
|
|
1201
|
-
```
|
|
1202
|
-
|
|
1203
|
-
**Official Reporters:**
|
|
1204
|
-
|
|
1205
|
-
- `@parcel/reporter-cli`
|
|
1206
|
-
- `@parcel/reporter-dev-server`
|
|
1207
|
-
- [todo]
|
|
1208
|
-
|
|
1209
|
-
### Validators
|
|
1210
|
-
|
|
1211
|
-
Validators emit errors for source code after a build is completed.
|
|
1212
|
-
For example, type checking and linting.
|
|
1213
|
-
|
|
1214
|
-
```json
|
|
1215
|
-
{
|
|
1216
|
-
"validators": {
|
|
1217
|
-
"*.ts": ["@parcel/validator-typescript"]
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
```
|
|
1221
|
-
|
|
1222
|
-
**Official Validators:**
|
|
1223
|
-
|
|
1224
|
-
- `@parcel/validator-typescript`
|
|
1225
|
-
- `@parcel/validator-eslint`
|
|
1226
|
-
- [todo]
|
|
1227
|
-
|
|
1228
|
-
## Creating Plugins
|
|
1229
|
-
|
|
1230
|
-
### Naming
|
|
1231
|
-
|
|
1232
|
-
All plugins must follow a naming system:
|
|
1233
|
-
|
|
1234
|
-
| | Official package | Community packages | Private company/scoped team packages |
|
|
1235
|
-
| ---------- | -------------------------- | ------------------------- | ------------------------------------ |
|
|
1236
|
-
| Configs | `@parcel/config-{name}` | `parcel-config-{name}` | `@scope/parcel-config[-{name}]` |
|
|
1237
|
-
| Resolvers | `@parcel/resolver-{name}` | `parcel-resolver-{name}` | `@scope/parcel-resolver[-{name}]` |
|
|
1238
|
-
| Transforms | `@parcel/transformer-{name}` | `parcel-transformer-{name}` | `@scope/parcel-transformer[-{name}]` |
|
|
1239
|
-
| Bundlers | `@parcel/bundler-{name}` | `parcel-bundler-{name}` | `@scope/parcel-bundler[-{name}]` |
|
|
1240
|
-
| Namers | `@parcel/namer-{name}` | `parcel-namer-{name}` | `@scope/parcel-namer[-{name}]` |
|
|
1241
|
-
| Runtimes | `@parcel/runtime-{name}` | `parcel-runtime-{name}` | `@scope/parcel-runtime[-{name}]` |
|
|
1242
|
-
| Packagers | `@parcel/packager-{name}` | `parcel-packager-{name}` | `@scope/parcel-packager[-{name}]` |
|
|
1243
|
-
| Optimizers | `@parcel/optimizer-{name}` | `parcel-optimizer-{name}` | `@scope/parcel-optimizer[-{name}]` |
|
|
1244
|
-
| Reporters | `@parcel/reporter-{name}` | `parcel-reporter-{name}` | `@scope/parcel-reporter[-{name}]` |
|
|
1245
|
-
| Validators | `@parcel/validator-{name}` | `parcel-validator-{name}`| `@scope/parcel-validator[-{name}]` |
|
|
1246
|
-
|
|
1247
|
-
The `{name}` must be descriptive and directly related to the purpose of the
|
|
1248
|
-
package. Someone should be able to have an idea of what the package does simply
|
|
1249
|
-
by reading the name in a `.parcelrc` or `package.json#devDependencies`.
|
|
1250
|
-
|
|
1251
|
-
```
|
|
1252
|
-
parcel-transformer-posthtml
|
|
1253
|
-
parcel-packager-wasm
|
|
1254
|
-
parcel-reporter-graph-visualizer
|
|
1255
|
-
```
|
|
1256
|
-
|
|
1257
|
-
If your plugin adds support for a specific tool, please use the name of the
|
|
1258
|
-
tool.
|
|
1259
|
-
|
|
1260
|
-
```
|
|
1261
|
-
parcel-transformer-es6 (bad)
|
|
1262
|
-
parcel-transformer-babel (good)
|
|
1263
|
-
```
|
|
1264
|
-
|
|
1265
|
-
If your plugin is a reimplementation of something that exists, try naming it
|
|
1266
|
-
something that explains why it is a separate:
|
|
1267
|
-
|
|
1268
|
-
```
|
|
1269
|
-
parcel-transformer-better-typescript (bad)
|
|
1270
|
-
parcel-transformer-typescript-server (good)
|
|
1271
|
-
```
|
|
1272
|
-
|
|
1273
|
-
We ask that community members work together and when forks happen to try and
|
|
1274
|
-
resolve them. If someone made a better version of your plugin, please consider
|
|
1275
|
-
giving the better package name over, have them make a major version bump, and
|
|
1276
|
-
redirect people to the new tool.
|
|
1277
|
-
|
|
1278
|
-
### Versioning
|
|
1279
|
-
|
|
1280
|
-
You must follow semantic versioning (to the best of your ability). No, it's not
|
|
1281
|
-
the perfect system, but it's the best one we have and people do depend on it.
|
|
1282
|
-
|
|
1283
|
-
If plugin authors intentionally don't follow semantic versioning, Parcel may
|
|
1284
|
-
start warning users that they should be locking down the version number for
|
|
1285
|
-
your plugin.
|
|
1286
|
-
|
|
1287
|
-
> Warning: The plugin "parcel-transform-typescript" does not follow semantic
|
|
1288
|
-
> versioning. You should lock the version range down so your code does not
|
|
1289
|
-
> break when they make changes. Please upvote this issue to encourage them to
|
|
1290
|
-
> follow semver: https://github.com/user/parcel-transform-typescript/issues/43
|
|
1291
|
-
|
|
1292
|
-
### Engines
|
|
1293
|
-
|
|
1294
|
-
You must specify a `package.json#engines.parcel` field with the version range
|
|
1295
|
-
of Parcel that your plugin supports:
|
|
1296
|
-
|
|
1297
|
-
```json
|
|
1298
|
-
{
|
|
1299
|
-
"name": "parcel-transform-imagemin",
|
|
1300
|
-
"engines": {
|
|
1301
|
-
"parcel": "2.x"
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
```
|
|
1305
|
-
|
|
1306
|
-
If you do not specify this field, Parcel will output a warning:
|
|
1307
|
-
|
|
1308
|
-
```
|
|
1309
|
-
Warning: The plugin "parcel-transform-typescript" needs to specify a `package.json#engines.parcel` field with the supported Parcel version range.
|
|
1310
|
-
```
|
|
1311
|
-
|
|
1312
|
-
If you do specify the parcel engine field and the user is using an incompatible
|
|
1313
|
-
version of Parcel, they will see an error:
|
|
1314
|
-
|
|
1315
|
-
```
|
|
1316
|
-
Error: The plugin "parcel-transform-typescript" is not compatible with the
|
|
1317
|
-
current version of Parcel. Requires "2.x" but the current version is "3.1.4"
|
|
1318
|
-
```
|
|
1319
|
-
|
|
1320
|
-
Parcel uses node-semver to match version ranges.
|
|
1321
|
-
|
|
1322
|
-
## Plugin APIs
|
|
1323
|
-
|
|
1324
|
-
There are several different types of plugins. They all look very similar, but
|
|
1325
|
-
are kept separate so we can have strict contracts one what each one is allowed
|
|
1326
|
-
to do.
|
|
1327
|
-
|
|
1328
|
-
There are some rules that should be followed across every type of plugin:
|
|
1329
|
-
|
|
1330
|
-
- **Stateless** — Avoid any kind of state, it will likely be the source of bugs
|
|
1331
|
-
for your users. For example, the same transform may exist in multiple
|
|
1332
|
-
separate workers which are not allowed to communicate with one another, state
|
|
1333
|
-
will not work as expected.
|
|
1334
|
-
- **Pure** — Given the same input, a plugin must produce the same output, and
|
|
1335
|
-
you must not have any observable side effects, or implicit dependencies.
|
|
1336
|
-
Otherwise Parcel's caching will break and your users will be sad. You should
|
|
1337
|
-
never have to tell users to delete their caches.
|
|
1338
|
-
|
|
1339
|
-
The plugin APIs all follow a common shape:
|
|
1340
|
-
|
|
1341
|
-
```js
|
|
1342
|
-
import {NameOfPluginType} from '@parcel/plugin';
|
|
1343
|
-
|
|
1344
|
-
export default new NameOfPluginType({
|
|
1345
|
-
async methodName(opts: JSONObject): Promise<JSONObject> {
|
|
1346
|
-
return result;
|
|
1347
|
-
}
|
|
1348
|
-
});
|
|
1349
|
-
```
|
|
1350
|
-
|
|
1351
|
-
They are made up of modules with well-known named exports of async functions
|
|
1352
|
-
that:
|
|
1353
|
-
|
|
1354
|
-
- Accept a strictly validated JSON-serializable `opts` object.
|
|
1355
|
-
- Return a strictly validated JSON-serializable `vals` object.
|
|
1356
|
-
|
|
1357
|
-
If something you need is not being passed through `opts`, please come talk to
|
|
1358
|
-
the Parcel team about it. Avoid trying to get information yourself from other
|
|
1359
|
-
sources, especially from the file system.
|
|
1360
|
-
|
|
1361
|
-
### Resolvers
|
|
1362
|
-
|
|
1363
|
-
Resolvers get called with an asset request (consisting of a source file path
|
|
1364
|
-
and the specifier of what is being requested) which it then attempts to
|
|
1365
|
-
resolve. If the resolver isn't sure how to handle a request, it can also return
|
|
1366
|
-
`null` and pass it to the next resolver in the chain.
|
|
1367
|
-
|
|
1368
|
-
```js
|
|
1369
|
-
import {Resolver} from '@parcel/plugin';
|
|
1370
|
-
|
|
1371
|
-
export default new Resolver({
|
|
1372
|
-
async resolve({dependency}) {
|
|
1373
|
-
// ...
|
|
1374
|
-
return {filePath} || null;
|
|
1375
|
-
}
|
|
1376
|
-
});
|
|
1377
|
-
```
|
|
1378
|
-
|
|
1379
|
-
### Transforms
|
|
1380
|
-
|
|
1381
|
-
Transforms _transform_ single assets as they are discovered and added to the
|
|
1382
|
-
asset graph. They mostly call out to different compilers and preprocessors.
|
|
1383
|
-
|
|
1384
|
-
```js
|
|
1385
|
-
import {Transform} from '@parcel/plugin';
|
|
1386
|
-
|
|
1387
|
-
export default new Transform({
|
|
1388
|
-
async getConfig({asset}) {
|
|
1389
|
-
// ...
|
|
1390
|
-
return config;
|
|
1391
|
-
},
|
|
1392
|
-
|
|
1393
|
-
async parse({asset}) {
|
|
1394
|
-
// ...
|
|
1395
|
-
return ast;
|
|
1396
|
-
},
|
|
1397
|
-
|
|
1398
|
-
async transform({asset}) {
|
|
1399
|
-
// ...
|
|
1400
|
-
return [assets];
|
|
1401
|
-
},
|
|
1402
|
-
|
|
1403
|
-
async generate({asset}) {
|
|
1404
|
-
// ...
|
|
1405
|
-
return {code, map};
|
|
1406
|
-
}
|
|
1407
|
-
});
|
|
1408
|
-
```
|
|
1409
|
-
|
|
1410
|
-
### Bundler
|
|
1411
|
-
|
|
1412
|
-
Bundlers accept the entire asset graph and modify it to add bundle nodes that group the assets
|
|
1413
|
-
into output bundles.
|
|
1414
|
-
|
|
1415
|
-
```js
|
|
1416
|
-
import {Bundler} from '@parcel/plugin';
|
|
1417
|
-
|
|
1418
|
-
export default new Bundler({
|
|
1419
|
-
async bundle({graph}) {
|
|
1420
|
-
// ...
|
|
1421
|
-
},
|
|
1422
|
-
|
|
1423
|
-
async optimize({graph}) {
|
|
1424
|
-
// ...
|
|
1425
|
-
}
|
|
1426
|
-
});
|
|
1427
|
-
```
|
|
1428
|
-
|
|
1429
|
-
### Namers
|
|
1430
|
-
|
|
1431
|
-
Namers accept a bundle and output a filename for that bundle.
|
|
1432
|
-
|
|
1433
|
-
```js
|
|
1434
|
-
import {Namer} from '@parcel/plugin';
|
|
1435
|
-
|
|
1436
|
-
export default new Namer({
|
|
1437
|
-
async name({bundle, bundleGraph}) {
|
|
1438
|
-
// ...
|
|
1439
|
-
return name;
|
|
1440
|
-
}
|
|
1441
|
-
});
|
|
1442
|
-
```
|
|
1443
|
-
|
|
1444
|
-
### Runtimes
|
|
1445
|
-
|
|
1446
|
-
Runtimes accept a bundle and return assets to be inserted into that bundle.
|
|
1447
|
-
|
|
1448
|
-
```js
|
|
1449
|
-
import {Runtime} from '@parcel/runtime';
|
|
1450
|
-
|
|
1451
|
-
export default new Runtime({
|
|
1452
|
-
async apply({bundle, bundleGraph}) {
|
|
1453
|
-
// ...
|
|
1454
|
-
return assets;
|
|
1455
|
-
}
|
|
1456
|
-
});
|
|
1457
|
-
```
|
|
1458
|
-
|
|
1459
|
-
### Packagers
|
|
1460
|
-
|
|
1461
|
-
Packagers determine how to merge different asset types into a single bundle.
|
|
1462
|
-
|
|
1463
|
-
```js
|
|
1464
|
-
import {Packager} from '@parcel/plugin';
|
|
1465
|
-
|
|
1466
|
-
export default new Packager({
|
|
1467
|
-
async package({bundle}) {
|
|
1468
|
-
// ...
|
|
1469
|
-
return {contents, map};
|
|
1470
|
-
},
|
|
1471
|
-
});
|
|
1472
|
-
```
|
|
1473
|
-
|
|
1474
|
-
### Optimizers
|
|
1475
|
-
|
|
1476
|
-
Optimizers are similar to transformers, but they accept a bundle instead
|
|
1477
|
-
of a single asset.
|
|
34
|
+
Read the docs at https://parceljs.org/docs/.
|
|
1478
35
|
|
|
1479
|
-
|
|
1480
|
-
import {Optimizer} from '@parcel/plugin';
|
|
36
|
+
## Community
|
|
1481
37
|
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
return {contents, map};
|
|
1486
|
-
}
|
|
1487
|
-
});
|
|
1488
|
-
```
|
|
38
|
+
- ❓ Ask questions on [GitHub Discussions](https://github.com/parcel-bundler/parcel/discussions).
|
|
39
|
+
- 💬 Join the community on [Discord](https://discord.gg/XSCzqGRuvr).
|
|
40
|
+
- 📣 Stay up to date on new features and announcements on [Twitter](https://twitter.com/parceljs).
|
|
1489
41
|
|
|
1490
|
-
|
|
42
|
+
## Contributors
|
|
1491
43
|
|
|
1492
|
-
|
|
1493
|
-
|
|
44
|
+
This project exists thanks to all the people who contribute. [[Contribute]](CONTRIBUTING.md).
|
|
45
|
+
<a href="https://github.com/parcel-bundler/parcel/graphs/contributors"><img src="https://opencollective.com/parcel/contributors.svg?width=890" title="contributors" alt="contributors" /></a>
|
|
1494
46
|
|
|
1495
|
-
|
|
1496
|
-
import {Reporter} from '@parcel/plugin';
|
|
47
|
+
## Backers
|
|
1497
48
|
|
|
1498
|
-
|
|
1499
|
-
async report({ event: { type, ... } }) {
|
|
1500
|
-
// ...
|
|
1501
|
-
}
|
|
1502
|
-
});
|
|
1503
|
-
```
|
|
49
|
+
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/parcel#backer)]
|
|
1504
50
|
|
|
1505
|
-
|
|
51
|
+
<a href="https://opencollective.com/parcel#backers" target="_blank"><img src="https://opencollective.com/parcel/backers.svg?width=890"></a>
|
|
1506
52
|
|
|
1507
|
-
|
|
1508
|
-
in some way, e.g. type errors or linting errors.
|
|
53
|
+
## Sponsors
|
|
1509
54
|
|
|
1510
|
-
|
|
1511
|
-
import {Validator} from '@parcel/plugin';
|
|
55
|
+
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/parcel#sponsor)]
|
|
1512
56
|
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
57
|
+
<a href="https://opencollective.com/parcel/sponsor/0/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/0/avatar.svg"></a>
|
|
58
|
+
<a href="https://opencollective.com/parcel/sponsor/1/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/1/avatar.svg"></a>
|
|
59
|
+
<a href="https://opencollective.com/parcel/sponsor/2/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/2/avatar.svg"></a>
|
|
60
|
+
<a href="https://opencollective.com/parcel/sponsor/3/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/3/avatar.svg"></a>
|
|
61
|
+
<a href="https://opencollective.com/parcel/sponsor/4/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/4/avatar.svg"></a>
|
|
62
|
+
<a href="https://opencollective.com/parcel/sponsor/5/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/5/avatar.svg"></a>
|
|
63
|
+
<a href="https://opencollective.com/parcel/sponsor/6/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/6/avatar.svg"></a>
|
|
64
|
+
<a href="https://opencollective.com/parcel/sponsor/7/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/7/avatar.svg"></a>
|
|
65
|
+
<a href="https://opencollective.com/parcel/sponsor/8/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/8/avatar.svg"></a>
|
|
66
|
+
<a href="https://opencollective.com/parcel/sponsor/9/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/9/avatar.svg"></a>
|