Skip to content

BUG: Fails to bundle sharp@0.33.1  #1153

Closed
vercel/webpack-asset-relocator-loader
#199

Description

@jlarmstrongiv

In the latest versions of sharp (e.g. sharp@0.33.1), ncc no longer includes sharp-linux-x64.node or libvips-cpp.so.42

image

However, ncc previously included the correct sharp files (e.g. sharp@0.32.6)

image

Unfortunately, this bug occurs in a popular library and causes severe errors

Activity

  1. jlarmstrongiv commented on Jan 4, 2024

    @jlarmstrongiv
    Author

    Related CI failures #1151

  2. yasiruk commented on Apr 9, 2025

    @yasiruk

    I am also able to reproduce this. The following docker container that sets up a sharp test script fails to build using ncc. The build hangs without exiting.

    FROM node:lts-bullseye as builder
    # create a package.json
    RUN echo '{"name":"ncc-test","version":"1.0.0","description":"test for ncc + sharp bundling issue","main":"index.js","license":"MIT","scripts":{"start":"node dist/index.js","build":"ncc --debug build index.js"},"devDependencies":{"@vercel/ncc":"0.38.3"},"dependencies":{"sharp":"0.34.1"}}' > package.json
    RUN echo 'const sharp=require("sharp");sharp({create:{width:300,height:200,channels:4,background:{r:255,g:255,b:255,alpha:.5}}}).png().toFile("empty_image.png",(a,e)=>{a&&process.exit(1)})' > index.js
    RUN npm i
    RUN npm run build
    
    FROM node:lts-bullseye as runner
    COPY --from=builder /dist/index.js /dist/index.js
    CMD ["node", "/dist/index.js"]
  3. styfle commented on Apr 9, 2025

    @styfle
    Member

    The root cause is likely in https://github.com/vercel/webpack-asset-relocator-loader if anyone wants to submit a PR there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions