#Do I need to run npm i @vercel/analytics
12 messages · Page 1 of 1 (latest)
It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.
If you use @astrojs/vercel you don't need @vercel/analytics package. See how to enable analytics in Astro config here https://docs.astro.build/en/guides/integrations-guide/vercel/#web-analytics
Hey, I've followed this guide as well but I can't build my website. I'm using the @astrojs/vercel and in astro.config.mjs file I already added as import vercel from '@astrojs/vercel/serverless'. The issue is, when I run yarn build it displays the following error:
Package subpath './errors' is not defined by "exports" in /home/user/company/website/node_modules/astro/package.json imported from /home/user/company/website/node_modules/@astrojs/vercel/dist/serverless/adapter.js
I don't think you can build serverless like that, it's only possible for @astrojs/vercel/static with static output.
To test/build serverless you need to use Vercel CLI
So could I change it to static as well as in the output?
I guess? If you don't use any SSR, you may switch to static
Thanks @rigid belfry I'll give it a go. Will update here!
I changed my astro config to static on my import as well as the output, as it was originally. Could WebAnalytics still be set to true under this configuration? 😮
import { defineConfig } from 'astro/config';
import vercel from '@astrojs/vercel/static';
export default defineConfig({
output: 'static',
adapter: vercel({
webAnalytics: {
enabled: true,
},
})
});
it works with any output
I think I should let it collect data before it shows on the Vercel Dashboard then!