Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: document using custom .parcelrc file #145

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/pages/framework/customization/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"src": "Use src Directory",
"html": "Replace the HTML",
"alias": "Alias Imports",
"internal-path": "Internal Paths"
"internal-path": "Internal Paths",
"custom-parcelrc": "Custom .parcelrc"
}
38 changes: 38 additions & 0 deletions src/pages/framework/customization/custom-parcelrc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
description: Using custom .parcelrc
---

import { Callout } from "nextra-theme-docs"

# Customizing Parcel with custom `.parcelrc`

Plasmo allows you to customize the Parcel bundler configuration by using a custom `.parcelrc` file. This file lets you override or extend the default settings, enabling you to tailor the build process to your project's specific needs.

## Overview

The `.parcelrc` file is a JSON configuration file placed in the root of your project. It defines how Parcel processes your assets by specifying transformers, bundlers, namers, and runtimes.

If you don't create a `.parcelrc` file, Plasmo will use its default configuration. However, advanced use cases can leverage a custom file to introduce custom behavior or integrate additional plugins.

<Callout>

Important: For your Plasmo project to build correctly, the custom configuration file must extend `@plasmohq/parcel-config`. This ensures that all necessary default settings and optimizations are inherited for seamless integration with Plasmo's build system.

</Callout>

## Example

### Using custom parcel namer

```json
{
"extends": "@plasmohq/parcel-config",
"namers": ["parcel-namer-hashless"]
}
```

This config setup and applies a custom namer plugin to generate hashless file names.

## Conclusion

The `.parcelrc` file is a powerful tool for customizing the Parcel bundler within your Plasmo projects. By tweaking the configuration, you can optimize the build process, integrate custom plugins, and tailor the toolchain to your project’s needs.