divriots/jampack

@astrojs/vercel/static or @astrojs/vercel/server make jampack unusable

Closed this issue · 5 comments

Hello,

I have this error when I build my website : Failed to create _jampack folder.
I use the last version of Jampack and you can fork my project to execute the error here

Tell me ifI can help to fix this with more information

Hi!

When jampack runs on your folder, it creates a _jampack folder and optimizes all content.

You should not try to run jampack twice on the same folder.

Recommendation is: always run jampack on a freshly build output.

I will update the error message to: "static website already optimised with jampack" or something like this.

Message updated in 0.24.4

Okay, but I delete the folder locally, and when I deploy it on vercel, I have the same message.

Please don't close my issue, it's not completed

So, like I said, with the last update, I delete the jampack folder from my target, I build and it's failing with the error "Folder _jampack is present in target folder. This means that jampack has already processed this folder. You should always run jampack on clean build of the static website.".

Looking at your package.json https://github.com/No1ceTea/no1cekeebs/blob/47-vercel-web-analytics-doesnt-work/package.json#L7

I guess npm build is called multiple times in the process.
astro check and astro build are fine to work incrementally but not jampack.

To make sure you always jampack a clean build you can do:
"build": "rm -fr ./dist && astro check && astro build && jampack ./dist"

But I don't know if you want to run jampack on every build.
Maybe you should only run jampack on deploy only.

I'm not familiar enough with @astro/vercel deployment process to recommend something else.