Skip to content

Parcel installs both gnu and musl bindings on GNU linux-arm64 #10248

@davidjb

Description

@davidjb

🐛 bug report

Following on from #8995, I noticed that Parcel installs both gnu and musl bindings on linux-arm64 platforms. I'm deploying to AWS Lambda, so a gnu libc environment, meaning the musl packages and bindings consume ~85 MB extra space that goes unused (of a total 208 MB node_modules).

🎛 Configuration (.babelrc, package.json, cli command)

N/A. See below for CLI install commands.

🤔 Expected Behavior

Parcel to only install required bindings for the current platform.

😯 Current Behavior

Parcel installs both gnu and musl packages, resulting in a lot of unused disk space.

💁 Possible Solution

Deploying to Lambda has a maximum deployment size of 250 MB so in order to meet this, I'm needing to rm -rf these various unused package directories and files out from inside node_ modules. Doing so doesn't break Parcel thankfully, but it would be safer and easier to avoid the install entirely - or for Parcel to clean itself up after determining which of gnu or musl will be used if installation can't be distinguished at that point of npm install.

🔦 Context

Trying to use Parcel on AWS Lambda (maximum deployment size of 250 MB), so node_modules must be as small as possible to allow deployment and allow integration with other code and tooling.

💻 Code Sample

This runs a publicly-hosted container for AWS Lambda AL2023 to match the same Linux environment, then installs Parcel, demonstrating the results:

docker run -it --entrypoint bash public.ecr.aws/lambda/provided:al2023-rapid-arm64 

# dnf install -y nodejs findutils
# yes "" | npm init
# npm install parcel@2.16.3

# du -sh node_modules
208M    node_modules/

# find node_modules -name '*musl*' | xargs du -c -sh
476K    node_modules/@parcel/watcher-linux-arm64-musl
376K    node_modules/@parcel/source-map/parcel_sourcemap_node/artifacts/index.linux-arm64-musl.node
452K    node_modules/@parcel/source-map/parcel_sourcemap_node/artifacts/index.linux-x64-musl.node
45M     node_modules/@parcel/rust-linux-arm64-musl
31M     node_modules/@swc/core-linux-arm64-musl
16K     node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64/node.napi.musl.node
16K     node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64/node.abi115.musl.node
556K    node_modules/@lmdb/lmdb-linux-arm64/node.napi.musl.node
7.7M    node_modules/lightningcss-linux-arm64-musl
85M     total

🌍 Your Environment

Software Version(s)
Parcel v2.16.3
Node v18.20.8
npm/Yarn 10.8.2
Operating System Amazon Linux release 2023.9.20251117

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions