Skip to content

Parcel not minifying by default even when it says it does #9619

@remino

Description

@remino

💬 RFC

https://parceljs.org/features/production

By default, minification is enabled when using the parcel build command. You can use the --no-optimize CLI flag to disable minification and other optimizations if needed.

No, it doesn't.

An issue from 2021 clearly state that's also not the case when it is a library.

🔦 Context

When you're new to Parcel, reading that it does but then seeing it doesn't then trying to figure out why is a waste of time. The text should read:

Except for JavaScript libraries, minification is enabled by default when using the parcel build command. You can use the --no-optimize CLI flag to disable minification and other optimizations if needed.

And examples should be provided on enabling minification.

The issue linked above provides a solution to add the following in your package.json:

{
  "targets": {
    "main": {
      "optimize": true
    }
  }
}

This works for the main, but adding similar rules for the module target doesn't work.

💻 Examples

See description above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions