πŸ“¦πŸš€ Blazing fast, zero configuration web application bundler

Overview

Parcel

Backers on Open Collective Sponsors on Open Collective Build Status npm package npm package Twitter Follow

Features

  • πŸš€ Blazing fast bundle times - multicore compilation, and a filesystem cache for fast rebuilds even after a restart.
  • πŸ“¦ Out of the box support for JS, CSS, HTML, file assets, and more - no plugins to install.
  • 🐠 Automatically transforms modules using Babel, PostCSS, and PostHTML when needed - even node_modules.
  • βœ‚οΈ Zero configuration code splitting using dynamic import() statements.
  • πŸ”₯ Built in support for hot module replacement
  • 🚨 Friendly error logging experience - syntax highlighted code frames help pinpoint the problem.

Below is the design document that was created before work on the implementation of Parcel 2 started and some sections are outdated. The actual (somewhat complete) documentation for Parcel 2 is available here: https://v2.parceljs.org/.


Getting Started

Before we get started, you'll need to install Node and Yarn (or npm) and create a package.json for your project if you haven't already.

yarn init

Then with Yarn you can install parcel into your app:

yarn add --dev parcel@next

From there you just need to point Parcel at some of your entry files. Like if you're building a website, an index.html file:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My First Parcel App</title>
  </head>
  <body>
    <h1>Hello, World!</h1>
  </body>
</html>

Now if you just run:

yarn parcel index.html

You should get a URL that looks something like: http://localhost:1234/.

Next you can start adding dependencies by specifying them in your code (however your language specifies other assets). So for HTML we could create a styles.css file next to our index.html file and include it with a <link> tag.

h1 {
  color: hotpink;
  font-family: cursive;
}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My First Parcel App</title>
    <link rel="stylesheet" href="./styles.css" />
  </head>
  <body>
    <h1>Hello, World!</h1>
  </body>
</html>

If we want parcel to update our changes in the browser without refreshing the page, we need to add at least a dummy javascript file e.g. app.js next to our index.html. This file allows parcel to inject all the necessary code to show your changes. This file will later contain your javascript application.

console.log("Hello World");
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My First Parcel App</title>
    <link rel="stylesheet" href="./styles.css" />
    <script src="./app.js"></script>
  </head>
  <body>
    <h1>Hello, World!</h1>
  </body>
</html>

Documentation

Introduction

Parcel is a compiler for all your code, regardless of the language or toolchain.

Parcel takes all of your files and dependencies, transforms them, and merges them together into a smaller set of output files that can be used to run your code.

Parcel supports many different languages and file types out of the box, from web technologies like HTML, CSS, and JavaScript, to lower level languages like Rust, and anything that compiles to WebAssembly (WASM), to assets like images, fonts, videos, and more.

Parcel makes your code portable. You can build your code for different environments, for the web for your server, or for an app. You can even build multiple targets at once and have them live update as you make changes.

Parcel is fast and predictable. It compiles all of your files in isolation in parallel inside workers, caching all of them as it goes along. Caches are stable across machines and are only affected by the files and configs within your project (unless you want to pass specific environment variables).

Parcel CLI

The Parcel CLI is built into the main parcel package. While you can install it globally and run it, it is much better to install it locally into your project as a dev dependency.

yarn add --dev parcel@next

You should also add some "scripts" to your package.json to run it easier.

{
  "name": "my-project",
  "scripts": {
    "build": "parcel build index.html",
    "start": "parcel serve index.html"
  },
  "devDependencies": {
    "parcel": "latest"
  }
}

Now you can run yarn build to bundle your project for production and yarn start to dev on your project.

CLI Args & Flags

Usage:

$ parcel [command] [...entries] [...flags]

parcel serve

Serve assets on a local server.

parcel watch

Watch and rebuild code on file changes.

parcel build

Build code once, in production mode.

[...entries]

Entry files to start bundling, these will be preserved as entry points in the output. Defaults to package.json#source, falling back to src/index.* or index.*. See #Sources.

--target [name]

Specifies a specific target to build. If unspecified, Parcel builds all targets specified in package.json. See #Targets.

--open, -o [browser]

Open your local server in a browser. You can optionally pass the name of the browser you want to open, otherwise it will use your default browser.

--host <host>

Configure the host to serve assets on. The default is to listen on all interfaces.

--port <port>, -p

Configure the port to serve assets on. Alternatively you can use the $PORT environment variable.

--https

This will generate a local certificate (which will be untrusted by your browser, you'll need to approve it) and serve your assets over https://

--cert <path>

Specify the filepath to your SSL certificate when using --https.

--key <path>

Specify the filepath to your SSL key when using --https.

--dist-dir <dir>

Configure the directory where compiled assets are output. Default is ./dist.

--cache-dir <dir>, --no-cache

Configure the cache directory with --cache <dir> or disable it altogether with --no-cache.

--hot, --no-hot

Turn hot reloading on or off.

--hot-host <hostname>

Configure the hot reloading hostname.

--hot-port <port>

Configure the hot reloading port.

--[no-]source-maps

Turn source maps on or off. Source maps are turned on by default.

--autoinstall [npm/yarn], --no-autoinstall

When enabled, whenever Parcel discovers a dependency that isn't installed it will attempt to install it with either npm or Yarn (defaults to npm unless a yarn.lock exists).

--log-level <level>

Set the log level, either either "none", "error", "warn", "info", or "verbose". The default is "info".

--version, -v, -V

Return the current version of Parcel.

--help, -h

Get help with the CLI.

Parcel Config

Parcel has always and will always work out of the box for many projects with zero configuration. It should always be extremely simple to get started. But if you do want more control, we give you the tools to do so.

Configuring external tools

A huge part of what Parcel does is run other tools over your code. Instead of pulling all that configuration into Parcel, we make use of their own configuration systems. So if you're using Babel, you should just use .babelrc files to configure it.

When we do need to introduce config, we create tool specific config files in order to do so.

Configuring Parcel

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
  • If you need to configure your package, it will be in the package.json
  • If you need to configure something with your files or the Parcel asset pipeline, it will be in .parcelrc

package.json

[todo]

{
  "name": "foo",
  "main": "dist/main/index.js",
  "module": "dist/module/index.js",
  "browser": "dist/browser/index.js",
  "browserslist": ["> 1%", "not dead"],
  "engines": {
    "node": ">=4.x"
  },
  "source": "src/index.js",
  "targets": {
    "main": {
      "engines": {
        "node": ">=4.x"
      }
    },
    "module": {
      "engines": {
        "node": ">=8.x"
      }
    },
    "browser": {
      "engines": {
        "browsers": ["> 1%", "not dead"]
      }
    }
  },
  "alias": {
    "react": "preact-compat",
    "react-dom": "preact-compat"
  }
}

package.json#name

(Required) The name of the package is always required in order to be considered a valid package.json.

{
  "name": "my-package"
}

package.json#version

(Required) All packages inside node_modules must have a package.json#version.

{
  "version": "1.0.0"
}

package.json#main

This is the "main" target's entry point for the package, by default in library mode (doesn't bundle dependencies).

{
  "main": "dist/main/index.js"
}

See Targets

package.json#module

This is the "module" target's entry point for the package, by default in library mode (doesn't bundle dependencies).

{
  "module": "dist/module/index.js"
}

See Targets

package.json#browser

This is the "browser" target's entry point for the package, by default in library mode (doesn't bundle dependencies).

{
  "browser": "dist/browser/index.js"
}

See Targets

package.json#source

Specify the entry points for your source code which gets mapped to your targets.

{
  "source": "src/index.js",
  "source": ["src/index.js", "src/index.html"]
}

See Sources

package.json#browserslist

As specified by Browserslist, this field is for specifying which transformers should be applied to browser bundles.

{
  "browserslist": ["> 0.2%", "not dead"]
}

See Environments

package.json#engines

Specify what versions of what engines you want to support.

{
  "engines": {
    "node": ">=4.x",
    "electron": ">=2.x"
  }
}

See Environments

package.json#targets

Configuration for individual targets.

{
  "targets": {
    "main": {
      "engines": {
        "node": ">=4.x",
        "electron": ">=2.x"
      },
    },
    "browser": {
      "engines": {
        "browsers": ["> 1%", "not dead"]
      }
    }
  }
}

See Targets

package.json#alias

Aliases asset names/paths to other assets.

{
  "alias": {
    "react": "preact-compat",
    "react-dom": "preact-compat"
  }
}

See Aliases

.parcelrc

Your .parcelrc file will likely contain just a few fields (if you have one at all), but here's an example of a .parcelrc file that contains every field:

{
  "extends": ["@parcel/config-default"],
  "resolvers": ["@parcel/resolver-default"],
  "transformers": {
    "*.vue": ["@parcel/transformer-vue"],
    "*.scss": ["@parcel/transformer-sass"],
    "*.js": ["@parcel/transformer-babel"],
    "*.css": ["@parcel/transformer-postcss"],
    "*.html": ["@parcel/transformer-posthtml"]
  },
  "bundler": "@parcel/bundler-default",
  "namers": ["@parcel/namer-default"],
  "runtimes": ["@parcel/runtime-js", "@parcel/runtime-browser-hmr"],
  "packagers": {
    "*.js": "@parcel/packager-js",
    "*.css": "@parcel/packager-css",
    "*.html": "@parcel/packager-html",
    "*.wasm": "@parcel/packager-wasm",
    "*.raw": "@parcel/packager-raw"
  },
  "optimizers": {
    "*.js": ["@parcel/optimizer-uglify"],
    "*.css": ["@parcel/optimizer-cssnano"],
    "*.html": ["@parcel/optimizer-htmlnano"],
    "*.{png,jpg,jpeg,svg,...}": ["@parcel/optimizer-imagemin"]
  },
  "reporters": ["@parcel/reporter-cli"]
}

Glob maps in .parcelrc

Many config properties like transformers or packagers use objects as maps of globs to package names. While objects in JSON are technically unordered, Parcel does use the order to give globs priority when a file name is being tested against them.

{
  "transformers": {
    "icons/*.svg": ["highest-priority"],
    "*.svg": ["lowest-priority"]
  }
}

Here if we are trying to find a transform for the file icons/home.svg, we'll work our way down the globs until we find a match, which would be icons/*.svg, we never reach *.svg.

.parcelrc#extends

extends can either be a string or an array of strings that specify base configs to extend. That base configuration can be the path to another .parcelrc file or the name of a Parcel config package.

{
  "extends": "@parcel/config-default",
  "extends": "../.parcelrc",
  "extends": ["@parcel/config-default", "@company/parcel-config"]
}

When extending a config, Parcel does a shallow merge of the two configs.

.parcelrc#resolvers

resolvers is an array of strings that specifies the name of a Parcel resolver package.

{
  "resolvers": ["@parcel/resolver-default"]
}

See Resolvers

.parcelrc#transformers

transformers is an object map of globs to arrays of Parcel transform packages.

{
  "transformers": {
    "*.js": ["@parcel/transformer-babel"]
  }
}

See Transformers

.parcelrc#bundler

bundler is a string that specifies the name of a Parcel bundler package.

{
  "bundler": "@parcel/bundler-default"
}

See Bundlers

.parcelrc#namers

namers is an array of Parcel namer packages.

{
  "namers": ["@parcel/namer-default"]
}

See Namers

.parcelrc#runtimes

runtimes is an array of Parcel runtime packages.

{
  "runtimes": ["@parcel/runtime-js", "@parcel/runtime-browser-hmr"],
}

See Runtimes

.parcelrc#packagers

packagers is an object map of globs to Parcel packager packages.

{
  "packagers": {
    "*.js": ["@parcel/packager-js"]
  }
}

See Packagers

.parcelrc#optimizers

optimizers is an object map of globs to arrays of Parcel optimizer packages.

{
  "optimizers": {
    "*.js": ["@parcel/optimizer-uglify"]
  }
}

See Optimizers

.parcelrc#reporters

reporters is an array of Parcel reporter packages.

{
  "reporters": ["@parcel/reporter-detailed"]
}

See Reporters.

.parcelrc#validators

validators is an object map of globs to arrays of Parcel validator packages.

  "validators": {
    "*.ts": ["@parcel/validator-typescript"]
  }
}

See Validators.

Parcel Architecture

Even if you aren't doing anything that complex, if you are going to use Parcel a lot it makes sense to take some time and understand how it works.

Phases of Parcel

At a high level Parcel runs through several phases:

  • Resolving
  • Transforming
  • Bundling
  • Packaging
  • Optimizing
  • (Validating)

The resolving and transforming phases work together in parallel to build a graph of all your assets.

This asset graph gets translated into bundles in the bundling phase.

Then the packaging phase takes the assets in the calculated bundles and merges them together into files each containing an entire bundle.

Finally, in the optimizing phase, Parcel takes these bundles files and runs them through optimizing transforms.

Asset Graph

During the resolving and transforming phases, Parcel discovers all the assets in your app or program. Every asset can have its own dependencies on other assets which Parcel will pull in.

The data structure that represents all of these assets and their dependencies on one another is known as "The Asset Graph".

Asset Name Dependencies
index.html app.css, app.js
app.css N/A
app.js navbar.js
navbar.js etc.

Bundles

Once Parcel has built the entire Asset Graph, it begins turning it into "bundles". These bundles are groupings of assets that get placed together in a single file.

Bundles will (generally) contain only assets in the same language:

Bundle Name Assets
index.html index.html
app.css app.css
app.js app.js, navbar.js, etc.

Some assets are considered "entry" points into your app, and will stay as separate bundles. For example, if your index.html file links to an about.html file, they won't be merged together.

Bundle Name Assets Entry URL
index.html index.html /
about.html about.html /about

Sources

"Sources" are the files that contain the source code to your app before being compiled by Parcel.

Parcel discovers these sources by following their dependencies on one another starting at your "entries".

These entries will be one of:

  1. $ parcel <...entries>
  2. ~/package.json#source
  3. ./src/index.*
  4. ./index.*

From there, everything those assets depend on will be considered a "source" in Parcel.

Targets

When Parcel runs, it can build your asset graph in multiple different ways simultaneously. These are called "targets".

For example, you could have a "modern" target that targets newer browsers and a "legacy" target for older browsers.

Sources get mapped to targets,

Target Configuration

In the most explicit form, targets are configured via the package.json#targets field.

{
  "app": "dist/browser/index.js",
  "appModern": "dist/browserModern/index.js",
  "targets": {
    "app": { /* target env */ },
    "appModern": { /* target env */ }
  }
}

Each target has a name which corresponds to a top-level package.json field such as package.json#main or package.json#browser which specify the primary entry point for that target.

Inside each of those targets contains the target's environment configuration:

Option Possible values Description
context 'node' | 'browser' | 'web-worker' | 'electron-main' | 'electron-renderer' Where the bundle should run
includeNodeModules boolean | [String] Whether to bundle all/none/some node_module dependency
outputFormat 'global' | 'esmodule' | 'commonjs' Which type of imports/exports should be emitted
publicUrl string The public url of the bundle at runtime
isLibrary boolean Library as in 'npm library'
sourceMap boolean | {inlineSources?: boolean, sourceRoot?: string, inline?: boolean} Enable/disable sourcemap and set options
engines Engines Same as package.json#engines

However, a lot of the normal configuration you might want will already have defaults provided for you:

targets = {
  main: {
    engines: {
      node: value("package.json#engines.node"),
      browsers: unless exists("package.json#browser") then value("package.json#browserlist")
    },
    isLibrary: true
  },
  module: {
    engines: {
      node: value("package.json#engines.node"),
      browsers: unless exists("package.json#browser") then value("package.json#browserlist")
    },
    isLibrary: true
  },
  browser: {
    engines: {
      browsers: value("package.json#browserslist")
    },
    isLibrary: true
  },
  ...value("package.json#targets"),
}

Environments

Environments tell Parcel how to transform and bundle each asset. They tell Parcel if an asset is going to be run in a browser or in NodeJS/Electron.

They also tell Parcel's transform plugins how they should run. They tell Babel or Autoprefixer what browsers your asset is targetting.

You can configure environments through your targets.

{
  "targets": {
    "main": {
      "engines": {
        "node": ">=4.x",
        "electron": ">=2.x",
        "browsers": ["> 1%", "not dead"]
      }
    }
  }
}

When one asset depends on another, the environment is inherited from its parent. But how you depend on the asset can change some properties of that environment.

For example:

navigator.serviceWorker.register('./service-worker.js');
let childEnvironment = {...parentEnvironment, browserContext: 'service-worker'};

Caching

Parcel will create a /.parcel-cache directory. It will be filled with directories with two letters, which are the start of a hash which is finished by the names of the JSON files inside.

/.parcel-cache
  /00/
    213debd8ddd45819b79a3a974ed487.json
    40ae9b581afc53841307a4b3c2463d.json
    63a9dd58fc1e8f8bb819759ea9793c.json
    ...
  /01/
  /../
  /zy/
  /zz/

It follows this weird structure in order to avoid too many files being created in a single directory, which degrades file system performance.

Asset Resolution

Parcel follows the Node module resolution algorithm with a few additions.

Local Paths

./path/to/file
./path/to/file.js

These follow the Node module resolution algorithm.

Package Paths

preact
lodash/cloneDeep
@sindresorhus/is

These follow the Node module resolution algorithm.

URLs

https://unpkg.com/[email protected]/dist/preact.min.js

Parcel by default will ignore URL dependencies, other resolver plugins may choose to do something with them.

Tilde Paths

~/src/file.js

Only when used outside of node_modules directories, the ~ is replaced by an absolute path to the closest package root:

/path/to/app #(/package.json)

To form a path that looks like:

/path/to/app/src/file.js

Then it follows the Node module resolution algorithm.

Aliases

Aliases come in two forms:

  1. Package Aliases: react -> preact
  2. File/Directory Aliases: utils -> ./src/utils
{
  "name": "my-project",
  "alias": {
    "react": "preact-compat",
    "react-dom": "preact-compat",
    "utils": "./src/utils",
    "components": "./src/components"
  }
}

There are a couple of rules:

  1. Aliases will only be respected when specified outside of node_modules.
  2. Aliases specified outside of node_modules will affect assets inside of node_modules.
  3. Aliases cannot build off of other aliases.
  4. Only one alias will be applied at a time.
  5. Aliases must be valid npm package names.

Plugins

Resolvers

When one asset depends on another through an asset specifier, the resolver is responsible for determining what asset is being requested.

See Asset Resolution for more details.

{
  "resolvers": ["@parcel/resolver-v1"]
}

Official Resolvers:

  • @parcel/resolver-v1

Transformers

transformers transform single assets as they are discovered and added to the asset graph. They mostly call out to different compilers and preprocessors.

{
  "transformers": {
    "*.js": ["@parcel/transformer-babel"]
  }
}

Official Transformers:

  • @parcel/transformer-babel
  • @parcel/transformer-coffeescript
  • @parcel/transformer-glsl
  • @parcel/transformer-graphql
  • @parcel/transformer-json
  • @parcel/transformer-json5
  • @parcel/transformer-less
  • @parcel/transformer-posthtml
  • @parcel/transformer-postcss
  • @parcel/transformer-pug
  • @parcel/transformer-raw
  • @parcel/transformer-reason
  • @parcel/transformer-rust
  • @parcel/transformer-stylus
  • @parcel/transformer-toml
  • @parcel/transformer-typescript
  • @parcel/transformer-vue
  • @parcel/transformer-wasm
  • @parcel/transformer-webmanifest
  • @parcel/transformer-yaml
  • @parcel/transformer-elm
  • ...

Bundlers

Bundlers accept the entire asset graph and turn it into sets of bundles.

{
  "bundler": "@parcel/bundler-default"
}

Official Bundlers:

  • @parcel/bundler-default

Namers

Namers accept a bundle and return a filename for that bundle.

{
  "namers": ["@parcel/namer-default"]
}

Official Namers:

  • @parcel/namer-default

Runtimes

Runtimes get called after the bundler phase and generate an asset which gets included in the final bundle.

{
  "runtimes": ["@parcel/runtime-js", "@parcel/runtime-browser-hmr"]
}

Official Runtimes:

  • @parcel/runtime-js
  • @parcel/runtime-hmr

Packagers

Packagers determine how to merge different asset types into a single bundle.

{
  "packagers": {
    "*.css": "@parcel/packager-css"
  }
}

Official Packagers:

  • @parcel/packager-html
  • @parcel/packager-js
  • @parcel/packager-css
  • @parcel/packager-wasm
  • @parcel/packager-raw

Optimizers

Optimizers are similar to transformers, but they accept a bundle instead of a single asset.

{
  "optimizers": {
    "*.js": ["@parcel/optimizer-terser"],
    "*.css": ["@parcel/optimizer-csso"]
  }
}

Official Optimizers:

  • @parcel/packager-terser
  • @parcel/packager-csso
  • [todo]

Reporters

Reporters receive events as they happen and can either use the Parcel logger to output to stdout/stderr or they can return assets to be generated on the file system.

{
  "reporters": ["@parcel/reporter-cli", "@parcel/reporter-dev-server"]
}

Official Reporters:

  • @parcel/reporter-cli
  • @parcel/reporter-dev-server
  • [todo]

Validators

Validators emit errors for source code after a build is completed. For example, type checking and linting.

{
  "validators": {
    "*.ts": ["@parcel/validator-typescript"]
  }
}

Official Validators:

  • @parcel/validator-typescript
  • @parcel/validator-eslint
  • [todo]

Creating Plugins

Naming

All plugins must follow a naming system:

Official package Community packages Private company/scoped team packages
Configs @parcel/config-{name} parcel-config-{name} @scope/parcel-config[-{name}]
Resolvers @parcel/resolver-{name} parcel-resolver-{name} @scope/parcel-resolver[-{name}]
Transformers @parcel/transformer-{name} parcel-transformer-{name} @scope/parcel-transformer[-{name}]
Bundlers @parcel/bundler-{name} parcel-bundler-{name} @scope/parcel-bundler[-{name}]
Namers @parcel/namer-{name} parcel-namer-{name} @scope/parcel-namer[-{name}]
Runtimes @parcel/runtime-{name} parcel-runtime-{name} @scope/parcel-runtime[-{name}]
Packagers @parcel/packager-{name} parcel-packager-{name} @scope/parcel-packager[-{name}]
Optimizers @parcel/optimizer-{name} parcel-optimizer-{name} @scope/parcel-optimizer[-{name}]
Reporters @parcel/reporter-{name} parcel-reporter-{name} @scope/parcel-reporter[-{name}]
Validators @parcel/validator-{name} parcel-validator-{name} @scope/parcel-validator[-{name}]

The {name} must be descriptive and directly related to the purpose of the package. Someone should be able to have an idea of what the package does simply by reading the name in a .parcelrc or package.json#devDependencies.

parcel-transformer-posthtml
parcel-packager-wasm
parcel-reporter-graph-visualizer

If your plugin adds support for a specific tool, please use the name of the tool.

parcel-transformer-es6 (bad)
parcel-transformer-babel (good)

If your plugin is a reimplementation of something that exists, try naming it something that explains why it is a separate:

parcel-transformer-better-typescript (bad)
parcel-transformer-typescript-server (good)

We ask that community members work together and when forks happen to try and resolve them. If someone made a better version of your plugin, please consider giving the better package name over, have them make a major version bump, and redirect people to the new tool.

Versioning

You must follow semantic versioning (to the best of your ability). No, it's not the perfect system, but it's the best one we have and people do depend on it.

If plugin authors intentionally don't follow semantic versioning, Parcel may start warning users that they should be locking down the version number for your plugin.

Warning: The plugin "parcel-transform-typescript" does not follow semantic versioning. You should lock the version range down so your code does not break when they make changes. Please upvote this issue to encourage them to follow semver: https://github.com/user/parcel-transform-typescript/issues/43

Engines

You must specify a package.json#engines.parcel field with the version range of Parcel that your plugin supports:

{
  "name": "parcel-transform-imagemin",
  "engines": {
    "parcel": "2.x"
  }
}

If you do not specify this field, Parcel will output a warning:

Warning: The plugin "parcel-transform-typescript" needs to specify a `package.json#engines.parcel` field with the supported Parcel version range.

If you do specify the parcel engine field and the user is using an incompatible version of Parcel, they will see an error:

Error: The plugin "parcel-transform-typescript" is not compatible with the
current version of Parcel. Requires "2.x" but the current version is "3.1.4"

Parcel uses node-semver to match version ranges.

Plugin APIs

There are several different types of plugins. They all look very similar, but are kept separate so we can have strict contracts one what each one is allowed to do.

There are some rules that should be followed across every type of plugin:

  • Stateless β€” Avoid any kind of state, it will likely be the source of bugs for your users. For example, the same transform may exist in multiple separate workers which are not allowed to communicate with one another, state will not work as expected.
  • Pure β€” Given the same input, a plugin must produce the same output, and you must not have any observable side effects, or implicit dependencies. Otherwise Parcel's caching will break and your users will be sad. You should never have to tell users to delete their caches.

The plugin APIs all follow a common shape:

import {NameOfPluginType} from '@parcel/plugin';

export default new NameOfPluginType({
  async methodName(opts: JSONObject): Promise<JSONObject> {
    return result;
  }
});

They are made up of modules with well-known named exports of async functions that:

  • Accept a strictly validated JSON-serializable opts object.
  • Return a strictly validated JSON-serializable vals object.

If something you need is not being passed through opts, please come talk to the Parcel team about it. Avoid trying to get information yourself from other sources, especially from the file system.

Resolvers

Resolvers get called with an asset request (consisting of a source file path and the specifier of what is being requested) which it then attempts to resolve. If the resolver isn't sure how to handle a request, it can also return null and pass it to the next resolver in the chain.

import {Resolver} from '@parcel/plugin';

export default new Resolver({
  async resolve({dependency}) {
    // ...
    return {filePath} || null;
  }
});

Transformers

Transformers transform single assets as they are discovered and added to the asset graph. They mostly call out to different compilers and preprocessors.

import {Transform} from '@parcel/plugin';

export default new Transform({
  async parse({asset}) {
    // ...
    return ast;
  },

  async transform({asset}) {
    // ...
    return [assets];
  },

  async generate({asset}) {
    // ...
    return {code, map};
  }
});

Bundler

Bundlers accept the entire asset graph and modify it to add bundle nodes that group the assets into output bundles.

import {Bundler} from '@parcel/plugin';

export default new Bundler({
  async bundle({graph}) {
    // ...
  },

  async optimize({graph}) {
    // ...
  }
});

Namers

Namers accept a bundle and output a filename for that bundle.

import {Namer} from '@parcel/plugin';

export default new Namer({
  async name({bundle, bundleGraph}) {
    // ...
    return name;
  }
});

Runtimes

Runtimes accept a bundle and return assets to be inserted into that bundle.

import {Runtime} from '@parcel/runtime';

export default new Runtime({
  async apply({bundle, bundleGraph}) {
    // ...
    return assets;
  }
});

Packagers

Packagers determine how to merge different asset types into a single bundle.

import {Packager} from '@parcel/plugin';

export default new Packager({
  async package({bundle}) {
    // ...
    return {contents, map};
  },
});

Optimizers

Optimizers are similar to transformers, but they accept a bundle instead of a single asset.

import {Optimizer} from '@parcel/plugin';

export default new Optimizer({
  async optimize({bundle, contents, map}) {
    // ...
    return {contents, map};
  }
});

Reporters

Reporters receive events as they happen and can output to stdout/stderr, or perform other actions.

import {Reporter} from '@parcel/plugin';

export default new Reporter({
  async report({ event: { type, ... } }) {
    // ...
  }
});

Validators

Validators receive an asset, and can throw errors if that asset is invalid in some way, e.g. type errors or linting errors.

import {Validator} from '@parcel/plugin';

export default new Validator({
  async validate({asset}) {
    // ...
    throw error;
  }
});

Some validators (such as @parcel/validator-typescript) may wish to maintain a project-wide cache for efficiency. For these cases, it is appropriate to use a different interface where parcel hands all changed files to the validator at the same time:

import {Validator} from '@parcel/plugin';

export default new Validator({
  async validateAll({assets}) {
    // ...
    throw error;
  }
});

If your plugin implements validateAll, Parcel will make sure to always invoke this method on the same thread (so that your cache state is accessible).

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Comments
  • Discuss .babelrc detection, engines field, etc.

    Discuss .babelrc detection, engines field, etc.

    Based on twitter convo:

    https://twitter.com/dan_abramov/status/938090483166924800

    I’d suggest to reconsider this (or at least limit it to compiling with -env preset only). This encourages authors to publish packages with stage 0 proposals, and ultimately makes builds slower for everyone. Also .babelrc won’t be compatible between Babel versions.

    :speech_balloon: RFC 
    opened by devongovett 107
  • How do i mark some modules to external?

    How do i mark some modules to external?

    Choose one: is this a πŸ› bug report or πŸ™‹ feature request?

    πŸ™‹ feature request

    πŸ€” Expected Behavior

    Don't include external module in bundled file everywhere. Like rollup globals option. https://rollupjs.org/#big-list-of-options

    🌍 Your Environment

    | Software | Version(s) | ---------------- | ---------- | Parcel | 1.0.3 | Node | 9.2.0 | npm/Yarn | Yarn 1.2.1 | Operating System | Windows 10

    :raising_hand_woman: Feature :pray: Help Wanted βœ¨ Parcel 2 
    opened by garrydzeng 95
  • Hot Module Reloading not working, dev server not being updated.

    Hot Module Reloading not working, dev server not being updated.

    πŸ› bug report

    I followed the steps exactly here: https://parceljs.org/getting_started.html Making changes to either the js or html file does not cause any update to occur at localhost:1234 when parcel index.html is run.

    I also followed the react recipe verbatim with the same issue: http://blog.jakoblind.no/react-parcel/ Saving the file doesn't refresh the dev server.

    πŸŽ› Configuration (.babelrc, package.json, cli command)

    package.json

    {
      "name": "parcel",
      "version": "1.0.0",
      "description": "",
      "main": "index.html",
      "scripts": {
        "start": "parcel index.html"
      },
      "keywords": [],
      "author": "",
      "license": "ISC",
      "dependencies": {
        "react": "^16.4.1",
        "react-dom": "^16.4.1"
      },
      "devDependencies": {
        "babel-preset-env": "^1.7.0",
        "babel-preset-react": "^6.24.1",
        "parcel-bundler": "^1.9.2"
      }
    }
    

    .babelrc

    {
        "presets": [
            "env",
            "react"
        ]
    }
    

    console command

    npm start also tried parcel serve index.html and parcel index.html --no-cache

    πŸ€” Expected Behavior

    Saved changes should cause the dev server to refresh

    😯 Current Behavior

    Content builds correctly when the command is first run however, the dev server is not refreshed when a change is saved, so even refreshing the page doesn't do anything.

    πŸ”¦ Context

    I tried using global parcel-bundler as well as a local installation.

    πŸ’» Code Sample

    Followed the get started guide and react-recipe blog exactly.

    index.html

    <!DOCTYPE html>
    <html>
    
    <head>
        <title>React starter app</title>
    </head>
    <body>
        <div id="app"></div>
        <script src="index.js"></script>
    </body>
    </html>
    

    index.js

    import React from "react";
    import ReactDOM from "react-dom";
    
    class HelloMessage extends React.Component {
      render() {
        return <div>Hlo{this.props.name + this.props.name}</div>;
      }
    }
    
    var mountNode = document.getElementById("app");
    ReactDOM.render(<HelloMessage name="Jane" />, mountNode);
    

    🌍 Your Environment

    Tried in chrome as well as firefox

    | Software | Version(s) | | ---------------- | ---------- | | Parcel | 1.9.2 | Node | 8.11.3 | npm/Yarn | 5.6.0 | Operating System | Mac | Firefox Dev edition | 62.0b1 | Chrome | 67.0.3396.87

    :bug: Bug 
    opened by vpicone 75
  • Bundler freezes since 1.8.0

    Bundler freezes since 1.8.0

    πŸ› Bug report

    πŸ€” Expected Behavior

    The bundler should finish the process.

    😯 Current Behavior

    Bundler freezes on build and does not finish at all. Previously I had version 1.7.0 and sometimes it was frozen as well but that was only several times and when restarted it mostly worked. After upgrade to version 1.8.1 I tried to build approx. 20 times but it did not finish at all. No changes in project. I tried version 1.8.0 and it did not work either.

    πŸ”¦ Context

    My project is just index.html with references scripts. Typescript is used in project. App based on React and Bootstrap.

    🌍 Your Environment

    | Software | Version(s) | | ---------------- | ---------- | | Parcel | ^1.8.0 | | Node | 9.11.1 | | npm | 5.6.0 | | Operating System | Windows 10 |

    :bug: Bug :heavy_check_mark: Confirmed Bug 
    opened by jpergler 61
  • Cannot read property 'type' of undefined

    Cannot read property 'type' of undefined

    πŸ› bug report

    I have a small VueJS project. I am running "parcel watch index.html --log-level 4 --out-dir wwwroot" from npm. On version 1.11.0 it would stop reacting to file changes after a few saves. I updated to version 1.12.0 and the same thing is happening but now I get an error (see below).

    Note: I downgraded to parcel version 1.10.3 and everything works as expected when watching.

    πŸŽ› Configuration (.babelrc, package.json, cli command)

    {
      "name": "abs-setup",
      "description": "ABS Setup",
      "author": "Wayne Hiller",
      "scripts": {
        "dev": "parcel watch index.html --log-level 4 --out-dir wwwroot",
        "build": "parcel build index.html --out-dir wwwroot",
        "publish": "npm run build && del-cli bin/Release/netcoreapp2.2/publish && dotnet publish -c Release /p:PublishProfile=Properties\\\\PublishProfiles\\\\FolderProfile.pubxml"
      },
      "devDependencies": {
        "@aspnet/signalr": "1.1.2",
        "@babel/core": "7.3.4",
        "@babel/preset-env": "7.3.4",
        "@vue/component-compiler-utils": "^2.6.0",
        "axios": "0.18.0",
        "bootstrap": "4.3.1",
        "bootstrap-vue": "2.0.0-rc.11",
        "less": "^3.9.0",
        "parcel-bundler": "1.12.0",
        "parcel-plugin-clean-easy": "1.0.2",
        "vue": "2.6.7",
        "vue-axios": "2.1.4",
        "vue-template-compiler": "^2.6.7",
        "del-cli": "1.1.0"
      },
      "dependencies": {
        "vue-hot-reload-api": "^2.3.3"
      },
      "parcelCleanPaths": [
        "wwwroot/*.*",
        "wwwroot/debug"
      ]
    }
    

    πŸ€” Expected Behavior

    No error

    😯 Current Behavior

    Error being generated after 5 or 6 saves of the same .vue file.

    [12:13:38 PM]: Γ— Cannot read property 'type' of undefined [12:13:38 PM]: at Bundler.createBundleTree (E:\Development\AIN 2\ABS\Setup\ABS Setup\node_modules\parcel-bundler\src\Bundler.js:652:54) at Bundler.createBundleTree (E:\Development\AIN 2\ABS\Setup\ABS Setup\node_modules\parcel-bundler\src\Bundler.js:719:12) at Bundler.createBundleTree (E:\Development\AIN 2\ABS\Setup\ABS Setup\node_modules\parcel-bundler\src\Bundler.js:719:12) at Bundler.bundle (E:\Development\AIN 2\ABS\Setup\ABS Setup\node_modules\parcel-bundler\src\Bundler.js:298:14) at process._tickCallback (internal/process/next_tick.js:68:7)

    🌍 Your Environment

    | Software | Version(s) | | ---------------- | ---------- | | Parcel | 1.12.0 | Node | 10.15.2 | npm/Yarn | 6.9.0 | Operating System | Win 10 x64

    :bug: Bug Watcher 
    opened by WayneHiller 59
  • Web Extension Transformer

    Web Extension Transformer

    β†ͺ️ Pull Request

    Adds support for bundling web extensions from a single manifest.json. Supports all standard features, plus a few non-standard but popular ones.

    Rewrite of #3439 Closes #3439 Closes #1039

    I'm not sure how necessary this is in Parcel's core, but I think it would give Parcel a massive advantage over bundlers like Webpack, for which massive amounts of config are required to get web extensions working even with community packages.

    πŸ’» Examples

    manifest.json:

    {
      "manifest_version": 2,
      "name": "Parcel WebExt",
      "version": "1.2.3",
      "default_locale": "en_US",
      "icons": {
        "100": "src/assets/foo.png"
      },
      "background": {
        "scripts": ["./src/background.js"],
        "persistent": true
      },
      "browser_action": {
        "default_icon": {
          "100": "src/assets/foo.png"
        },
        "default_popup": "src/popup.html"
      },
      "content_scripts": [{
        "matches": ["https://v2.parceljs.org/*"],
        "js": ["src/content.js"],
        "css": ["src/content.css"]
      }],
      "dictionaries": {
        "en-US": "./dicts/tmp.dic"
      },
      "devtools_page": "src/devtools.html",
      "web_accessible_resources": [
        "src/assets/**/*.txt"
      ]
    }
    

    If a file named manifest.json is given as an entry point and looks like a web extension manifest, it is validated for cross-browser compatibility, and all URL references are replaced. Assets that should not change location, such as _locales, are added as entry assets to prevent renaming.

    🚨 Test instructions

    Integration tests provided with this PR

    βœ”οΈ PR Todo

    • [x] Added/updated unit tests for this change
    • [x] Filled out test instructions (In case there aren't any unit tests) N/A
    • [x] Included links to related issues/PRs
    opened by 101arrowz 58
  • Build error with version 2.3.1: @parcel/core: Failed to resolve 'process' from ...

    Build error with version 2.3.1: @parcel/core: Failed to resolve 'process' from ...

    πŸ› bug report

    I just upgraded to version 2.3.1 and now the build process fails. Don't know exactly if this is a parcel or a sentry issue?

    πŸŽ› Configuration (.babelrc, package.json, cli command)

    {
        "presets": [
            [
                "@babel/preset-env",
                {
                    "modules": false,
                    "useBuiltIns": false,
                    "targets": {
                        "node": "current"
                    }
                }
            ],
            "@babel/preset-react"
        ],
        "plugins": [],
        "env": {
            "test": {
                "plugins": ["@babel/plugin-transform-modules-commonjs"]
            }
        }
    }
    
    

    πŸ€” Expected Behavior

    Build should pass.

    😯 Current Behavior

    The build fails with the following exception:

    🚨 Build failed.
    
    @parcel/core: Failed to resolve 'process' from './node_modules/@sentry/utils/esm/node.js'
    
      /Users/*****/Sites/*****/node_modules/@sentry/utils/esm/node.js:18:43
        17 | /**
      > 18 |  * Requires a module which is protected against bundler minification.
      >    |                                           ^^^^^^^^
        19 |  *
        20 |  * @param request The module path to resolve
    

    πŸ’ Possible Solution

    idk.

    πŸ”¦ Context

    πŸ’» Code Sample

    🌍 Your Environment

    | Software | Version(s) | | ---------------- | ---------- | | Parcel | 2.3.1 | Node | 16.11.1 | npm/Yarn | yarn: 1.22.17 | Operating System | mac osx

    opened by spointecker 53
  • ES Module type=module cause

    ES Module type=module cause "parcelRequire is not defined" error

    πŸ› bug report

    Using ES Module in main HTML cause "parcelRequire is not defined" error.
    If we use type="module", minimal code in Getting Started (Parcel official) make this error.

    πŸŽ› Configuration (.babelrc, package.json, cli command)

    zero configuration.

    πŸ€” Expected Behavior

    If we write super simple code with ES Module like below,

    <!-- index.html -->
    <html>
    <body>
    <script src="./index.js" type="module"></script>
    </body>
    </html>
    
    // index.js
    console.log("hello parcel");
    

    I hope it is bundled properly and get "hello parcel" in console without error.

    😯 Current Behavior

    In console,

    hello parcel.   index.js 1
    Uncaught ReferenceError: parcelRequire is not defined at test.904c6489.js:10
    

    πŸ’ Possible Solution

    Apparently ES Module cause this error.
    When I removed type="module" from script element, no error observed.

    It suggest that we can avoid error by avoiding type="module" for parcel.
    But I think this approach is not good.
    ES Module (type="module") is generally available (now 2018-05, all popular browsers supported!!), so ES module is straight forward way to import module.

    πŸ”¦ Context

    I do not know what problem is caused by this error.

    🌍 Your Environment

    | Software | Version(s) | | ---------------- | ---------- | | Parcel | [email protected] | | Node | (problem happen both) 8.9.3 & 9.11.1 | | npm/Yarn | | | Operating System | Windows10 Pro, build 17134 |

    Thank you good library, I hope this project become better and better.

    :raising_hand_woman: Feature :pray: Help Wanted βœ¨ Parcel 2 
    opened by tarepan 53
  • Add support for Web Extension manifest V3

    Add support for Web Extension manifest V3

    β†ͺ️ Pull Request

    Adds support for Manifest V3 to @parcel/transformer-webextension. Closes #6079 Fixes #6494 Fixes #7568 Fixes #7385 Fixes #7835 (mostly) Fixes #7808 Fixes #5865

    HMR is not working due to MV3 restrictions on CSP. Refreshing the page does update the extension though.

    βœ”οΈ PR Todo

    • [x] Added/updated unit tests for this change
    • [x] Included links to related issues/PRs
    opened by 101arrowz 51
  • "Name already registered with serializer" with parcel@next

    πŸ› bug report

    When I run parcel build I receive a "Name already registered with serializer" error

    πŸŽ› Configuration (.babelrc, package.json, cli command)

    Blank project with yarn2#pnp and parcel@next

    πŸ€” Expected Behavior

    No error while building

    😯 Current Behavior

    /yarnparcel/.yarn/cache/@parcel-core-npm-2.0.0-nightly.65-a3573223f8-1.zip/node_modules/@parcel/core/lib/serializer.js:28
        throw new Error('Name already registered with serializer');
        ^
    
    Error: Name already registered with serializer
        at registerSerializableClass (/yarnparcel/.yarn/cache/@parcel-core-npm-2.0.0-nightly.65-a3573223f8-1.zip/node_modules/@parcel/core/lib/serializer.js:28:11)
        at Object.<anonymous> (/yarnparcel/.yarn/$$virtual/@parcel-package-manager-virtual-dab9d78bc4/0/cache/@parcel-package-manager-npm-2.0.0-nightly.67-6d59c584b3-1.zip/node_modules/@parcel/package-manager/lib/Npm.js:82:37)
        at Module._compile (internal/modules/cjs/loader.js:956:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
        at Module.load (internal/modules/cjs/loader.js:812:32)
        at Function.module_1.Module._load (/yarnparcel/.pnp.js:24084:14)
        at Module.require (internal/modules/cjs/loader.js:849:19)
        at require (internal/modules/cjs/helpers.js:74:18)
        at Object.<anonymous> (/yarnparcel/.yarn/$$virtual/@parcel-package-manager-virtual-dab9d78bc4/0/cache/@parcel-package-manager-npm-2.0.0-nightly.67-6d59c584b3-1.zip/node_modules/@parcel/package-manager/lib/index.js:19:12)
        at Module._compile (internal/modules/cjs/loader.js:956:30)
    

    πŸ’ Possible Solution

    No Idea, sorry Β―\(ツ)/Β―

    πŸ”¦ Context

    I'm trying to setup a project with bleeding-edge tooling :)

    πŸ’» Code Sample

    This installs yarn@berry GLOBALLY, creates a sample project and produces the error

    mkdir yarnparcel
    cd yarnparcel
    npm i -g yarn@berry
    yarn init
    yarn add parcel@next
    echo "<h1>Hello</h1>" > index.html
    yarn run parcel build index.html
    

    🌍 Your Environment

    | Software | Version(s) | | ---------------- | ---------- | | Parcel | 2.0.0-alpha.3.2 | Node | 12.13.0 | Yarn | 2.0.0-rc.27 | Operating System | MacOS 10.14

    :bug: Bug βœ¨ Parcel 2 
    opened by Xiphe 51
  • πŸ›Uncaught Error: Cannot find module '21'

    πŸ›Uncaught Error: Cannot find module '21'

    πŸŽ› Configuration (.babelrc, package.json, cli command)

    .babelrc:

    {
      "presets": ["env"],
      "plugins": [
        ["babel-plugin-root-import", {
          "rootPathSuffix": "js",
          "rootPathPrefix": "@"
        }]
      ]
    }
    

    package.json:

    {
      "name": "hwm-parcel",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "makmm",
      "license": "MIT",
      "dependencies": {
        "babel-polyfill": "^6.26.0",
        "babel-preset-env": "^1.6.1"
      },
      "devDependencies": {
        "babel-core": "^6.26.0",
        "babel-plugin-root-import": "^5.1.0"
      }
    }
    

    πŸ€” Expected Behavior

    Run $ parcel index.html, go to localhost:1234, change something in the code and the browser should get the new code and load it

    😯 Current Behavior

    Run $ parcel index.html, go to localhost:1234, console shows correct sourcemaps: image

    change something in the code and this error comes up: image

    Refresh, now sourcemaps are broken: image

    πŸ’ Possible Solution

    No idea! <.<

    🌍 Your Environment

    | Software | Version(s) | | ---------------- | ---------- | | Parcel | 1.6.2 | | Node | 9.5.0 | | npm | 5.6.0 | | Operating System | Debian sid |

    :bug: Bug :heavy_check_mark: Confirmed Bug 
    opened by ghost 51
Releases(v2.8.2)
  • v2.8.2(Dec 14, 2022)

  • v2.8.1(Dec 8, 2022)

    Fixed

    • Core
      • fix: remove @parcel/utils dep in @parcel/graph – Details
    • JavaScript
      • Don't retarget dependencies with * – Details
      • Fix overriding single export of a export * – Details
      • Add mjs and cjs to resolver extensions – Details
    • TypeScript
      • Make ts-types transformer work with TS >= 4.8 – Details
    • Web manifest
      • Parse shortcut icons in web app manifests – Details
    • SVG
      • Fix transformer-svg-react not finding .svgrrc – Details
    Source code(tar.gz)
    Source code(zip)
  • v2.8.0(Nov 9, 2022)

    Blog post: https://parceljs.org/blog/v2-8-0/

    Added

    • Core
      • Code splitting across reexports using symbol data by splitting dependencies – Details
      • Update without bundling for non-dependency related changes – Details
      • Improve performance of incremental bundling – Details
      • Only serialize and send shared references to workers that need them – Details
      • Improve performance of HMR by not waiting for packaging – Details
    • JavaScript
      • Verify version when resolving Node builtin polyfills – Details
      • Add loadBundleConfig method to Packager plugins – Details
    • SVG
      • Generate typescript for SVGs when using svgr and typescript option – Details
    • Bundler
      • Move experimental bundler to default – Details

    Fixed

    • Core
      • Fix verbose warning: reexport all doesn't include default – Details
      • Support multiple edge types in Graph.hasEdge – Details
      • Ensure edge exists before removal in Graph.removeEdge – Details
      • Disable splitting dependencies on symbols for non-scope hoisted bundles – Details
      • Fix TypeScript definitions for Parcel config API – Details
      • Use traverseAssets in packager to improve performance – Details
      • Make uniqueKey undefined by default – Details
      • Catch uncaught promise build abort race – Details
      • Bump parcel dependencies – Details
    • JavaScript
      • Bump SWC - Details, Details
      • Fix Chrome Android browserslist support check – Details
      • Fix CommonJS symbol collection without scope hoisting – Details
      • Make React Refresh debounce call on the leading edge – Details
      • Retain correct dependency order between imports and reexports without scopehoisting – Details
    • Bundler
      • Consider sibling in available assets to younger sibling for parallel deps – Details
      • Don't merge isolated child assets – Details
      • Do not merge isolated bundles in experimental bundler – Details
      • Implement min bundles configuration – Details
    • Dev server
      • Include Content-Length header in HEAD requests – Details
    • Vue
      • Fix errors displaying errors when compiling Vue SFCs – Details
      • Add file path to error code frames – Details
      • Fix location of errors – Details
    • Image
    • TypeScript
      • Allow configuring module resolution – Details
    • Web extensions
      • Fix service worker packaging in web extensions – Details
    Source code(tar.gz)
    Source code(zip)
  • v2.7.0(Aug 3, 2022)

    Added

    • Core
      • Log resolved targets in verbose log level for debugging - Details
      • Allow plugin configs to be written with .cjs extension - Details
    • JavaScript
      • Support react refresh for @emotion/react - Details
      • Inject script for hmr when there is only normal script in html - Details
    • Elm
      • Add support for compiling multiple modules at once via with query param - Details
    • CSS
      • Add support for errorRecovery option in @parcel/transformer-css - Details
    • Experimental bundler - Details
      • Implement bundling for multiple targets
      • Internalize async dependencies
      • Merge bundles of the same type
      • Fix missing module - Details

    Fixed

    • JavaScript
      • Default interop missing when importing a CommonJS module - Details
      • Add missing imports for external dependencies in skipped assets - Details
      • Bump SWC to fix undefined variables - Details
      • Remove charset from JS loaded script to avoid double fetching in Firefox - Details
      • Use placeholder expression when replacing unused symbols - Details
    • Core
      • Fix atomic writestream handling on Windows - Details
      • Fix non-deterministic bundle hashes between builds due to symbol propagation - Details
      • Fix TypeScript types for @parcel/package-manager - Details
    • Dependencies
    Source code(tar.gz)
    Source code(zip)
  • v2.6.2(Jun 22, 2022)

  • v2.6.1(Jun 17, 2022)

    This release includes bug fixes:

    • JavaScript
      • Fix issue with conditional dependencies based on process.env - Details
      • Fix transformation of import/requires wrapped into Promise.resolve() - Details
      • Fix object literal shorthand with imported variables - Details
      • Fix imported values in computed optional member expressions - Details
      • Bump SWC to fix issue with missing parenthesis in optional chaining call - Details
      • Bump SWC to fix helper imports in Node ESM libraries - Details
    • Resolution
      • Add missing invalidateOnEnvChange to resolver - Details
      • Fix importing node_modules packages in glob resolver with sub-paths - Details
      • Error when external dependencies in libraries have incompatible semver ranges - Details
    • Web Extensions
      • Fix HMR for web extensions - Details
      • Fix web extensions issues with Safari - Details
      • Fix declarative_net_request property in web extension manifest - Details
    • Dev Server
      • Fix browser caching issues with dev server - Details
    • TypeScript
      • Fix path separators on Windows - Details
    • CSS
      • Bump Parcel CSS to fix issues with libc field in package.json - Details
    • Core
      • Fix atomic file writing race condition - Details
      • Bump lmdb dependency to fix multi-threading issue - Details
    Source code(tar.gz)
    Source code(zip)
  • v2.6.0(May 25, 2022)

    Blog post: https://parceljs.org/blog/v2-6-0/

    Added

    • Add React error overlay to display pretty runtime errors like Create React App - Details
    • Support for source maps in HMR updates - Details
    • Support for scoping variables in CSS modules - Details
    • Support for custom CSS modules naming patterns - Details
    • Support for node_modules packages in @parcel/resolver-glob - Details
    • Add support for defining compilerOptions in Vue config - Details
    • Add support for Vue 3 <script setup> - Details
    • Add support for gif, tiff, avif, heic, and heif images in @parcel/transformer-image - Details
    • Add support for animated images (i.e. gifs, webp, etc.) in @parcel/transformer-image - Details
    • Support for missing fields in web extensions manifest v3 - Details, Details
    • Improve elm compiler error output - Details
    • Support for useDefineForClassFields option in tsconfig.json - Details
    • Add --hmr-host CLI option to set HMR host independently from dev server - Details

    Fixed

    • Update lmdb-js. Fixes Node 18 support - Details, Details
    • Update napi-rs to v2 - Details
    • Fix SWC targets for older browsers - Details
    • Add SWC error handler to fix panic during transpilation - Details
    • Update SWC. Fixes issue with Symbol.toStringTag - Details
    • Bump SWC to fix spreads of imported symbols - Details
    • Correctly emit warnings for unnecessary PostCSS plugins in package.json - Details
    • Fix typo in error message - Details
    • Remove duplicate values in graph APIs when getting connected node ids - Details
    • Fix Pug support in Vue files - Details
    • Fix export declare syntax in generated TypeScript definitions - Details
    • Preserve correct this for named/default imports - Details
    • Fix hoisting for optional chaining member expressions - Details
    • Fix issues with web extensions - Details
    • Reload the closest package.json to an asset if it's a package entry to fix sideEffects - Details
    • Only emit non static import bailout warnings for variables which correspond to a * import - Details
    Source code(tar.gz)
    Source code(zip)
  • v2.5.0(Apr 21, 2022)

    This release includes new features, including improved Web Extension support and better output for Node.js targets, as well as upgrades to SWC and Parcel CSS, and many bug fixes. Thanks to everyone who contributed!

    Added

    • Add support for Web Extension manifest v3 - Details
    • Rewrite __dirname and __filename to refer to the original path when building for Node.js targets - Details
    • Generate codeframe positions for JSON5 - Details
    • Add $schema support in web extension manifest - Details
    • Add support for in expressions with process.env, e.g. 'foo' in process.env - Details

    Fixed

    • Updated SWC. - Details + Details
    • Update Parcel CSS to v1.8.1 - Details + Details
    • Fix diagnostic message - Details
    • Disable react refresh for library targets. Fixes "Asset was skipped or not found" error. - Details
    • Don't process inline <style> elements as CSS modules - Details
    • Fix issue with multiple images in srcset attribute - Details
    • Fix peer dependencies - Details + Details
    • Scope hoisting: Fix wrapping when any ancestor asset is wrapped - Details
    • Scope hoisting: Don't insert unused requires that aren't registered anywhere - Details
    • Scope hoisting: Fix wrapped assets importing their own namespace - Details
    • Fix issues with resolving symbols - Details
    • Fix loading .env files when entries are specified using "source" field in package.json - Details
    • Correctly remove orphaned non-tree subgraphs - Details
    Source code(tar.gz)
    Source code(zip)
  • v2.4.1(Mar 31, 2022)

    This release includes bug fixes.

    • Fix :export in CSS modules
    • Don't remove unused classes or @keyframes when a CSS module is processed by postcss
    • Fix bundling issue with CSS modules where unintended side effects from a different page could be run
    • Fix crash with CSS in multiple environments
    • Update Parcel CSS. Fixes issues with ::-webkit-scrollbar, list styles in CSS modules, @-moz-document, and more. See release notes.
    • Update SWC. Fixes an issue with parenthesized expressions following a return statement.
    Source code(tar.gz)
    Source code(zip)
  • v2.4.0(Mar 22, 2022)

    This release updates Parcel's default CSS transformer and minifier to use @parcel/css! This offers both improved both build performance and better minification. It also brings automatic transpilation of CSS for your browser targets, just like we have for JavaScript – no configuration needed.

    For most projects, this update should be seamless. Read our blog post for more upgrade instructions, and check out the updated CSS docs for full details on all of the new features.

    In addition, this release includes several other improvements and bug fixes:

    Added

    • Replace typeof before dead code elimination to improve bundle size - Details
    • Human readable file size in bundle analyzer report - Details
    • Improve emoji support detection - Details
    • Enable parsing static class initialization blocks - Details
    • Use PORT environment variable from .env files - Details
    • Use new react-jsx transform in React 16.14.0 - Details
    • Use relative path for bundle labels in bundle analysis - Details
    • Load dynamic imports at higher network priority in non-ESM builds - Details

    Fixed

    • Pin lmdb to 2.2.3 - Details
    • Prevent term-size from being bundled - Details
    • Fix cache when non-ascii chars are used in path - Details
    • Bump SWC. Fixes issue with String constructor. - Details
    • Fix DCE with PURE comments - Details
    • Escape double quote of url value in CSS url() - Details
    • Fix documentation comment in API - Details
    • Fix package.json source field resolution with pnpm - Details
    • Fix errors.map is not a function - Details
    Source code(tar.gz)
    Source code(zip)
  • v2.3.2(Feb 18, 2022)

  • v2.3.1(Feb 10, 2022)

    Followup release to v2.3.0 to improve the error message shown when auto install is disabled (e.g. in CI environments) and a node polyfill is needed. This may occur for example when using automated dependency upgrade bots like renovate/dependabot.

    This also fixes a bug where auto install did not work correctly in some cases, and pins all parcel dependency versions so that it is easier to pin parcel to a specific version in your project.

    Source code(tar.gz)
    Source code(zip)
  • v2.3.0(Feb 9, 2022)

    This release reduces the number of npm dependencies needed by Parcel by over 60%. This builds upon previous work in 2.2.0, so combined Parcel now installs over 70% fewer dependencies! This is accomplished by:

    • Pre-bundling some dependencies with Parcel itself rather than loading them from npm. This is done for packages that are small and internal to Parcel (i.e. you don't interact with them directly in your project). This reduces maintenance burden for users of Parcel.
    • Auto installing node builtin polyfills on demand (e.g. buffer, stream, etc.). These are rarely used but account for a large number of installed dependencies. Now, when you use one of these, or a dependency in your project does, it'll be installed into your project on demand.
    • Removing built-in Babel and PostCSS modules dependencies, and installing them into projects on demand, only when actually used.

    We will continue reducing Parcel's footprint in future releases by further reducing our use of dependency-heavy ecosystems such as PostCSS as we replace them with Rust-based equivalents.

    Other changes

    • Support React 18 prereleases and experimental versions with automatic JSX runtime - Details
    • Fix @swc/helpers in non-module scripts - Details
    • Fix auto installing dependencies in PNPM monorepos - Details
    Source code(tar.gz)
    Source code(zip)
  • v2.2.1(Jan 17, 2022)

    Fixed

    • Fix background image data urls missing quotes - Details
    • Fix development builds not downleveling nested selectors with @parcel/css. Now Parcel has default modern browser targets. - Details
    • Upgrades htmlnano to v2 to remove uncss which had a dependency on a vulnerable old version of PostCSS - Details
    • Upgrades postcss-modules and removes css-module-loader-core with old PostCSS dependencies - Details
    • Upgrade Vue compiler - Details
    • Upgrade SVGR to v6 - Details
    • Upgade JSON5 to v2 - Details
    • Don't discard invalidations when transformer throws an error - Details
    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Jan 12, 2022)

  • v2.1.0(Jan 5, 2022)

    Changelog

    New Contributors

    • @Shinyaigeek made their first contribution in https://github.com/parcel-bundler/parcel/pull/7295
    • @ConnorMooneyhan made their first contribution in https://github.com/parcel-bundler/parcel/pull/7314
    • @mrkldshv made their first contribution in https://github.com/parcel-bundler/parcel/pull/7236
    • @bhovhannes made their first contribution in https://github.com/parcel-bundler/parcel/pull/7363
    • @JensPfeifle made their first contribution in https://github.com/parcel-bundler/parcel/pull/7326
    • @wardpeet made their first contribution in https://github.com/parcel-bundler/parcel/pull/7369
    • @astralbody made their first contribution in https://github.com/parcel-bundler/parcel/pull/7451
    • @merceyz made their first contribution in https://github.com/parcel-bundler/parcel/pull/7506
    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(Nov 8, 2021)

    https://github.com/parcel-bundler/parcel/blob/v2/CHANGELOG.md#201---2021-11-08

    New Contributors 😍

    • @RuyiLi made their first contribution in https://github.com/parcel-bundler/parcel/pull/7056
    • @sibbng made their first contribution in https://github.com/parcel-bundler/parcel/pull/7079
    • @mkaraula made their first contribution in https://github.com/parcel-bundler/parcel/pull/7192
    • @arty-name made their first contribution in https://github.com/parcel-bundler/parcel/pull/7193
    • @v-rr made their first contribution in https://github.com/parcel-bundler/parcel/pull/7184
    • @ch99q made their first contribution in https://github.com/parcel-bundler/parcel/pull/7250
    • @Thesoreon made their first contribution in https://github.com/parcel-bundler/parcel/pull/7248
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Oct 13, 2021)

  • v2.0.0-rc.0(Aug 3, 2021)

  • v2.0.0-beta.3.1(May 20, 2021)

  • v2.0.0-beta.3(May 19, 2021)

  • v2.0.0-beta.2(Mar 16, 2021)

  • v2.0.0-beta.1(Jun 18, 2020)

Owner
Parcel
πŸ“¦πŸš€ Blazing fast, zero configuration web application bundler
Parcel
A blazing fast js bundler/loader with a comprehensive API :fire:

A bundler that does it right FuseBox on slack FUSEBOX v4 is out! Install: npm install fuse-box --save-dev import { fusebox } from 'fuse-box'; fusebox

null 4k Dec 30, 2022
Next-generation ES module bundler

Rollup Overview Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a librar

Rollup 22.7k Jan 4, 2023
on-demand module bundler thingy

lurantis An HTTP server that bundles and serves packages from NPM; "bundler as a service." Usage Run the server: npx lurantis --port 8080 Then, send G

Lily Scott 6 Feb 21, 2022
:fork_and_knife: Web applications made easy. Since 2011.

Brunch Web applications made easy. Since 2011. Fast front-end web app build tool with simple declarative config and seamless incremental compilation f

Brunch 6.8k Dec 25, 2022
πŸ“¦πŸš€ Blazing fast, zero configuration web application bundler

Features ?? Blazing fast bundle times - multicore compilation, and a filesystem cache for fast rebuilds even after a restart. ?? Out of the box suppor

Parcel 41.8k Jan 4, 2023
πŸ“¦ Zero-configuration bundler for tiny modules.

Microbundle The zero-configuration bundler for tiny modules, powered by Rollup. Guide β†’ Setup ✯ Formats ✯ Modern Mode ✯ Usage & Configuration ✯ All Op

Jason Miller 7.4k Dec 28, 2022
A blazing fast js bundler/loader with a comprehensive API :fire:

A bundler that does it right FuseBox on slack FUSEBOX v4 is out! Install: npm install fuse-box --save-dev import { fusebox } from 'fuse-box'; fusebox

null 4k Dec 30, 2022
A blazing fast js bundler/loader with a comprehensive API :fire:

A bundler that does it right FuseBox on slack FUSEBOX v4 is out! Install: npm install fuse-box --save-dev import { fusebox } from 'fuse-box'; fusebox

null 4k Jan 7, 2023
Minimal, zero-configuration and fast solution for static site generation in any front-end framework.

Staticit - Introduction Whether you want to increase performance of your web application or improve SEO. Generally you have 2 options, use SSR (Server

Engineerhub 4 Jun 11, 2022
⚑A zero-config bundler for JavaScript applications.

Poi is a bundler built on the top of webpack, trying to make developing and bundling apps with webpack as easy as possible. The Poi project is support

Eren Bets 5.3k Jan 4, 2023
πŸ“¦ 🍣 Zero-config JS bundler for ESM, CommonJS, and .d.ts outputs

pkgroll Write your code in ESM & TypeScript and bundle it to get ESM, CommonJS, and type declaration outputs with a single command! Features Zero conf

hiroki osame 153 Dec 23, 2022
πŸ“¦ 🍣 Zero-config JS bundler for ESM, CommonJS, and .d.ts outputs. (Forked from pkgroll)

?? ?? puild (A fork of pkgroll) Write your code in ESM & TypeScript and bundle it to get ESM, CommonJS, and type declaration outputs with a single com

ʀᴀʏ 6 Sep 6, 2022
Blazing fast Apple TV application development using pure JavaScript

atvjs Blazing fast Apple TV application development using pure JavaScript. Philosophy What's included Getting Started Basic Examples Creating Pages Ad

Emad Alam 292 Dec 14, 2022
Create blazing fast multithreaded Web Apps

Welcome to neo.mjs! neo.mjs enables you to create scalable & high performant Apps using more than just one CPU, without the need to take care of a wor

neo.mjs 2.4k Dec 31, 2022
Thin Backend is a Blazing Fast, Universal Web App Backend for Making Realtime Single Page Apps

Website | Documentation About Thin Thin Backend is a blazing fast, universal web app backend for making realtime single page apps. Instead of manually

digitally induced GmbH 1.1k Dec 25, 2022
a simple zero-configuration command-line http server

http-server: a command-line http server http-server is a simple, zero-configuration command-line http server. It is powerful enough for production usa

http ... PARTY! 12.4k Jan 4, 2023
A template to create a React Library. Zero configuration, just use!

React lib template ?? A simple React lib template based on Parcel and Jest. Usage use this template for your next React lib, modify it and run npm run

RaΓ­ Siqueira 15 Aug 22, 2022
Compile Master CSS ahead of time with zero-configuration integration with build tools

CSS Compiler Compile Master CSS ahead of time with zero-configuration integration with build tools On this page Usage webpack.config.js vite.config.js

Master 5 Oct 31, 2022
A blazing fast React alternative, compatible with IE8 and React 16.

Nerv is a virtual-dom based JavaScript (TypeScript) library with identical React 16 API, which offers much higher performance, tinier package size and

null 5.4k Jan 4, 2023