I’m using AstroJS with the Netlify adapter. Just today, though npm run dev
works, I’m getting this error during local build:
21:22:50 [build] Building hybrid entrypoints…
21:22:50 [ERROR] [vite] x Build failed in 17ms
Entry module “@astrojs/netlify/ssr-function.js” cannot be external.
I couldn’t find the problem, so I tried building a previous version of my code and am getting this error where I didn’t in the past. No package versions have changed, so I’m not sure what could be happening.
Here is package.json
{
...
"dependencies": {
"@astrojs/alpinejs": "^0.4.0",
"@astrojs/check": "^0.9.2",
"@astrojs/netlify": "^5.5.0",
"@astrojs/react": "^3.6.2",
"@astrojs/sitemap": "^3.1.6",
"@astrojs/tailwind": "^5.1.0",
"@iconify-json/fluent-emoji-high-contrast": "^1.1.15",
"@iconify-json/simple-icons": "^1.1.107",
"@portabletext/to-html": "^2.0.13",
"@portabletext/types": "^2.0.13",
"@sanity/astro": "^3.1.4",
"@sanity/client": "^6.21.0",
"@sanity/types": "^3.50.0",
"@sanity/visual-editing": "^2.1.6",
"@types/alpinejs": "^3.13.10",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"alpinejs": "^3.14.1",
"astro": "^4.13.3",
"astro-navbar": "^2.3.2",
"glob": "^11.0.0",
"netlify-cli": "^17.34.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-google-reviews": "^1.1.1",
"sanity": "^3.50.0",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.3"
},
"devDependencies": {
"@iconify/tailwind": "^1.1.1",
"accessible-astro-components": "^2.3.6"
}
}
and astro.config.mjs
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import sitemap from "@astrojs/sitemap";
import netlify from '@astrojs/netlify';
import sanity from "@sanity/astro";
import alpinejs from "@astrojs/alpinejs";
import react from "@astrojs/react";
// https://astro.build/config
export default defineConfig({
trailingSlash: 'ignore',
site: '...',
integrations: [tailwind(), alpinejs(), sitemap({
filter: page => page !== '...',
}), sanity({
projectId: '...',
dataset: 'staging',
useCdn: true,
apiVersion: "2024-07-13",
}), react()],
redirects: {
...
},
output: 'hybrid',
base: '.',
adapter: netlify()
});
If you have any ideas of what I should check, please let me know.
Thanks in advance!