Closed FlipFloop closed 7 months ago
I can confirm this error:
@astrojs/sitemap: sitemap-index.xml
created at dist
error (intermediate value).black is not a function File: C:\Users\cherie\Documents\evang9\meka1\node_modules\astro-compress\Target\Function\Integration.js:2:59 Code: 1 | let p;var P=(...[r={}])=>{Object.entries(r).forEach(([e,a])=>Object.defineProperty(r,e,{value:a===!0?u[e]:r[e]}));const{Path:o,Cache:s,Logger:g,Map:l,Exclude:h,Action:d,CSS:S,HTML:b,Image:j,JavaScript:A,SVG:T,Parser:y}=f(u,r),n=new Set;return typeof o<"u"&&(Array.isArray(o)||o instanceof Set)&&o.forEach(e=>n.add(e)),typeof y=="object"&&Object.entries(y).forEach(([e,a])=>Object.defineProperty(y,e,{value:Array.isArray(a)?a:[a]})),{name:"astro-compress",hooks:{"astro:config:done":async({config:{outDir:{pathname:e}}})=>{p=(await import("path")).parse(e).dir.replace(/\/g,"/"),p.startsWith("/")&&(p=p.substring(1))},"astro:build:done":async({dir:e})=>{if(console.log(`
2 | ${(await import("kleur")).bgGreen((await import("kleur")).black(" astro-compress processing "))}
),typeof l=="object"){n.size||n.add(e),typeof s=="object"&&s.Search===x&&(s.Search=e);for(const[a,i]of Object.entries({CSS:S,HTML:b,Image:j,JavaScript:A,SVG:T})){if(!(i&&l[a])||typeof i!="object")return;m=f(d,f(d,{Wrote:async({Buffer:t,Input:c})=>{switch(a){case"CSS":return(await import("csso")).minify(t.toString(),i.csso).css;case"HTML":return await(await import("html-minifier-terser")).minify(t.toString(),i["html-minifier-terser"]);case"JavaScript":return(await(await import("terser")).minify(t.toString(),i.terser)).code??t;case"Image":return await(await import("../Function/Image/Writesharp.js")).default(i.sharp,{Buffer:t,Input:c});case"SVG":{const{data:I}=(await import("svgo")).optimize(t.toString(),i.svgo);return I??t}default:return t}},Fulfilled:async t=>t.Files>0?
${(await import("kleur")).green(\u2713 Successfully compressed a total of ${t.Files} ${a} ${t.Files===1?"file":"files"} for ${await(await import("files-pipe/Target/Function/Bytes.js")).default(t.Info.Total)}.
)}`:!1})),a==="Image"&&(m=f(m,{Read:async({Input:t})=>{const{format:c}=await w(t).metadata();return w(t,{failOn:"none",sequentialRead:!0,unlimited:!0,animated:c==="webp"||c==="gif"})}}));for(const t of n)await(await(await(await new(await import("files-pipe")).default(s,g).In(t)).By(l[a]??"*/")).Not(h)).Pipe(m)}}}}}};const{default:u}=await import("../Variable/Option.js"),{default:{Cache:{Search:x}}}=await import("files-pipe/Target/Variable/Option.js"),{default:f}=await import("typescript-esbuild/Target/Function/Merge.js"),{default:w}=await import("sharp");let m;export{u as Default,w as Defaultsharp,f as Merge,x as Search,p as System,m as _Action,P as default}; | ^ Stacktrace: TypeError: (intermediate value).black is not a function at astro:build:done (file:///C:/Users/cherie/Documents/evang9/meka1/node_modules/astro-compress/Target/Function/Integration.js:2:59) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async withTakingALongTimeMsg (file:///C:/Users/cherie/Documents/evang9/meka1/node_modules/astro/dist/integrations/index.js:18:18) at async runHookBuildDone (file:///C:/Users/cherie/Documents/evang9/meka1/node_modules/astro/dist/integrations/index.js:328:7) at async AstroBuilder.build (file:///C:/Users/cherie/Documents/evang9/meka1/node_modules/astro/dist/core/build/index.js:145:5) at async AstroBuilder.run (file:///C:/Users/cherie/Documents/evang9/meka1/node_modules/astro/dist/core/build/index.js:165:7) at async build (file:///C:/Users/cherie/Documents/evang9/meka1/node_modules/astro/dist/core/build/index.js:44:3) at async build (file:///C:/Users/cherie/Documents/evang9/meka1/node_modules/astro/dist/cli/build/index.js:21:3) at async runCommand (file:///C:/Users/cherie/Documents/evang9/meka1/node_modules/astro/dist/cli/index.js:116:7) at async cli (file:///C:/Users/cherie/Documents/evang9/meka1/node_modules/astro/dist/cli/index.js:144:5)
Workaround: Downgrade to "astro-compress": "2.2.3", will fix this error.
Same error on netlify
AstroCompress
v2.2.4
has been deprecated and is unpublished.
Fixed in v2.2.5
Fails on NodeJS v18 and v20.
Here is my
package.json