parcel-bundler / watcher

👀 A native C++ Node module for querying and subscribing to filesystem events
MIT License
658 stars 44 forks source link

musl (Alpine) prebuild for darwin-arm64 #95

Closed sampullman closed 1 year ago

sampullman commented 2 years ago

Currently, when installing a package that depends on @parcel/watcher in an Alpine Docker image on my M1 Mac, none of the existing prebuilds match and a rebuild from source is required each time my node_modules changes. It also bloats the image size, since g++/make/python is required.

Is it possible to provide a musl prebuild for darwin-arm64?

My current workaround is to build @parcel/watcher locally for musl and manually copy the whole dependency + extra prebuild to the Dockerfile. It works fine but it would be nice to avoid the hack.

richmidwinter commented 2 years ago

Any chance you could share that hack?

sampullman commented 2 years ago

It's been quite a while since we implemented the workaround, so I may have forgotten something, but it's pretty much:

  1. Build @parcel/watcher with an arm64 prebuild
  2. Include somewhere in the repo
  3. Remove from package.json
  4. Copy to the dockerfile before install/build, e.g.
    # Copy in prebuilt @parcel/watcher
    COPY tools/prebuilds/@parcel/watcher ./node_modules/@parcel/watcher
    RUN npm install

Here's the prebuilt version we have in-repo: prebuilds.zip