Closed lucascompython closed 7 months ago
Can you tell me more about your version, node version as well (if any) and maybe the configuration options.
Sure here is my astro.config.mjs:
import { defineConfig } from "astro/config";
import compress from "astro-compress";
// https://astro.build/config
export default defineConfig({
vite: {
server: {
watch: {
ignored: ["**/target/**"]
}
}
},
integrations: [compress()]
});
tsconfig.json:
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"types": ["bun-types"]
}
}
My node version is 21.2.0. Astro version: 3.5.5 Astro-Compress version: 2.2.3
I'm unable to reproduce this on my local environment, can I ask you to open the file in VSCode, format it so that it's not minified or use a pretty print online https://beautifier.io/, save it and run again so we can debug this further.
Had the same issue, moved form bun to yarn. It worked. I don't think bun is quite a replacement for node/npm yet.
@hiteshjoshi It's working for me locally with this template https://github.com/Playform/AstroStarterTemplate on bun 1.0.13 node v21.2.0
Please if you can, either @hiteshjoshi or @lucascompython unminify (prettify whatever) the file and run build again, so we can debug this further. <3
So I prettified the file and I got the following output:
error Cannot access uninitialized variable.
File:
/home/lucas/Desktop/Separador/node_modules/astro-compress/Target/Function/Integration.js:37:28
Code:
36 | if (!(i && m[e]) || typeof i != "object") return;
> 37 | p = f(y, f(y, {
| ^
38 | Wrote: async ({
39 | Buffer: t,
40 | Input: c
Stacktrace:
ReferenceError: Cannot access uninitialized variable.
at <anonymous> (/home/lucas/Desktop/Separador/node_modules/astro-compress/Target/Function/Integration.js:37:28)
at astro:build:done (/home/lucas/Desktop/Separador/node_modules/astro-compress/Target/Function/Integration.js:24:21)
at <anonymous> (/home/lucas/Desktop/Separador/node_modules/astro/dist/integrations/index.js:330:51)
at processTicksAndRejections (:61:39)
I also noticed that if I try to add astro-compress with bunx --bun astro add astro-compress
the program crashes in the confirmation part. But this could be "normal", in the Astro documentation they do not use the --bun
flag.
Hi, @lucascompython, @hiteshjoshi, can you try v2.2.5 and see if the error fixed itself 😁 It's my only hope at this point.
Hi. I am sorry for the late reply. But it is working now. Thank you!
After installing astro-compress when I try to build I get the following error:
I am using Bun 1.0.13