PlayForm / Compress

🗜️ Compress —
https://NPMJS.Org/@playform/compress
MIT License
479 stars 12 forks source link

munmap_chunk(): invalid pointer #343

Closed bennycode closed 4 months ago

bennycode commented 4 months ago

I have been trying to use @playform/compress v0.0.3 in combination with astro v4.6.3. I often ran into issues when trying to load my Astro site. The build process stopped with the following message:

14:16:59 watching for file changes...
14:17:04 [astro-icon] Loaded icons from flat-color-icons, tabler
14:17:08 munmap_chunk(): invalid pointer 

After I removed @playform/compress from my astro.config.ts everything was fine.

This was my config:

import playformCompress from '@playform/compress';

// ...

playformCompress({
  CSS: true,
  HTML: {
    removeAttributeQuotes: false,
  },
  Image: false,
  JavaScript: true,
  SVG: true,
  Logger: 1,
})

Could my problems come from conflicting versions of sharp? Astro uses sharp@0.32.6 but @playform/compress wants sharp@0.33.3.

NikolaRHristov commented 4 months ago

Should be fixed the latest astro-compress v2.2.23 and @playform/compress v0.0.4

bennycode commented 4 months ago

I updated to @playform/compress v0.0.4 and it seems to work:

Compress: ✅ Successfully compressed a total of 1 CSS file for 429 Bytes. 23:49:34 [build] Waiting for integration "@playform/compress", hook "astro:build:done"... ✅ Successfully compressed a total of 294 HTML files for 304.97 KB. ✅ Successfully compressed a total of 1 JavaScript file for 5 Bytes. ✅ Successfully compressed a total of 1 SVG file for 4.91 KB.

Thank you for the fix! 🙏

NikolaRHristov commented 4 months ago

For future reference the issue was that sharp was being imported at the main level of the module Integration.ts instead of where the code is executed. sharp is now imported with:

await import('sharp')

only when it's needed. Glad it works. 🎉