#Vercel builds fail (@astrojs/vercel/static)

5 messages · Page 1 of 1 (latest)

crisp cradle
#

Hi! Im trying to deploy to vercel, but I always get the following error:

16:24:46 [build] Building static entrypoints...
16:24:50 [ERROR] [vite] [vite]: Rollup failed to resolve import "@/components/icons/Github.vue" from "/vercel/path0/src/components/Navbar.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

I already tried the solutions given in #4464 and #5172 (switching to serverless didn't work)

Code and more in the comments.

GitHub

What version of astro are you using? ^1.0.8 Are you using an SSR adapter? If so, which one? @astrojs/vercel What package manager are you using? yarn What operating system are you using? Mac Describ...

GitHub

What version of astro are you using? 1.5.2 Are you using an SSR adapter? If so, which one? @astrojs/vercel/static What package manager are you using? npm, yarn What operating system are you using? ...

#

This is my astro.config.mjs:

import { defineConfig } from 'astro/config';
import tailwind from "@astrojs/tailwind";
import icon from "astro-icon";
import vue from "@astrojs/vue";
import tunnel from "astro-tunnel";
import vercel from '@astrojs/vercel/static';
import VueDevTools from 'vite-plugin-vue-devtools'

import partytown from "@astrojs/partytown";

// https://astro.build/config
export default defineConfig({
  integrations: [
    tailwind({ applyBaseStyles: false }),
    icon(),
    vue(),
    tunnel({
      url: 'http://localhost:4321',
      port: 4321,
      acceptCloudflareNotice: true
    }),
    partytown()
  ],
  vite: {
    plugins: [
      VueDevTools(),
    ],
  },
  output: 'static',
  adapter: vercel({
    webAnalytics: {
      enabled: true
    }
  })
});

and this is my src\components\icons\Github.vue:

<script setup>
const { size, classes } = defineProps({
    size: String,
    classes: String
});
</script>

<template>
    <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="-2 -2 24 24" ]
        :class="{[`h-${size} w-${size}`]: size, [classes]: classes }">
        <!-- long <path> -->
    </svg>
</template>

and this is my src\components\Navbar.vue:

<script setup>
import { Button } from '@/components/ui/button'

import Github from '@/components/icons/Github.vue'
</script>

<template>
  <!-- ... -->
  <Button>
    <a href='#'>
      <Github size="5" classes="opacity-80" />
    </a>
  </Button>
  <!-- ... -->
</template>
#

running

pnpm run build
vercel deploy --prebuilt --prod

works fine. this is my vercel deployment settings:

crisp cradle
#

bumphouston_cry

lost hazel
#

could you also post your tsconfig?