{"record":{"id":"0e49af4138cc27a1","repo":"withastro/astro","slug":"astrojs-alpinejs-entrypoint-entrypoint-doe","errorCode":null,"errorMessage":"[@astrojs/alpinejs] entrypoint `${entrypoint}` does not export a default function. Check out https://docs.astro.build/en/guides/integrations-guide/alpinejs/#entrypoint.","messagePattern":"\\[@astrojs/alpinejs\\] entrypoint `(.+?)` does not export a default function\\. Check out https://docs\\.astro\\.build/en/guides/integrations-guide/alpinejs/#entrypoint\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/integrations/alpinejs/src/index.ts","lineNumber":80,"sourceCode":"\t\t\t\treturn resolvedVirtualModuleId;\n\t\t\t},\n\t\t},\n\t\tload: {\n\t\t\tfilter: {\n\t\t\t\tid: new RegExp(`^${resolvedVirtualModuleId}$`),\n\t\t\t},\n\t\t\thandler() {\n\t\t\t\tif (entrypoint) {\n\t\t\t\t\treturn `\\\nimport * as mod from ${JSON.stringify(entrypoint)};\n\t\t\t\t\t\t\nexport const setup = (Alpine) => {\n\tif ('default' in mod) {\n\t\tmod.default(Alpine);\n\t} else {\n\t\t${\n\t\t\t!isBuild\n\t\t\t\t? `console.warn(\"[@astrojs/alpinejs] entrypoint \\`\" + ${JSON.stringify(\n\t\t\t\t\t\tentrypoint,\n\t\t\t\t\t)} + \"\\` does not export a default function. Check out https://docs.astro.build/en/guides/integrations-guide/alpinejs/#entrypoint.\");`\n\t\t\t\t: ''\n\t\t}\n\t}\n}`;\n\t\t\t\t}\n\t\t\t\treturn `export const setup = () => {};`;\n\t\t\t},\n\t\t},\n\t};\n}\n\nexport default function createPlugin(options?: Options): AstroIntegration {\n\treturn {\n\t\tname: '@astrojs/alpinejs',\n\t\thooks: {\n\t\t\t'astro:config:setup': ({ injectScript, updateConfig }) => {","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/integrations/alpinejs/src/index.ts#L62-L98","documentation":"The @astrojs/alpinejs integration's `entrypoint` option generates a shim that imports your entry module and calls its default export with the Alpine instance. If the module exports only named functions (no default), the shim's `'default' in mod` check fails and — in dev only — it logs this warning, meaning your Alpine plugins/directives never register.","triggerScenarios":"Configuring alpinejs({ entrypoint: './src/alpine' }) where that file has `export function setup(Alpine)` or other named exports but no `export default`. The warning appears in the browser console during `astro dev`; production builds skip it (but the setup still silently no-ops).","commonSituations":"Writing the Alpine setup as a named export out of habit; refactoring the entry file and dropping the default keyword; mixing ESM named-export style with an integration that requires the default-export contract.","solutions":["Change the entrypoint to default-export a function: `export default function (Alpine) { ... }`","Move all plugin/directive registration (Alpine.directive, Alpine.magic, Alpine.plugin) inside that default function","Verify the path passed to `entrypoint` resolves to the intended file (a wrong path fails earlier with module-not-found)"],"exampleFix":"// before  src/alpine.ts\nexport function setup(Alpine: any) {\n  Alpine.magic('fmt', () => (v: number) => v.toFixed(2));\n}\n\n// after\nexport default function (Alpine: any) {\n  Alpine.magic('fmt', () => (v: number) => v.toFixed(2));\n}","handlingStrategy":"type-guard","validationCode":"// Fail loudly at bootstrap instead of relying on the dev-only runtime warning\nimport * as entry from './src/alpine';\nif (typeof entry.default !== 'function') {\n  throw new Error('src/alpine must default-export a function that receives Alpine');\n}","typeGuard":"const hasDefaultSetup = (mod: object): mod is { default: (Alpine: unknown) => void } =>\n  'default' in mod && typeof (mod as { default?: unknown }).default === 'function';","tryCatchPattern":null,"preventionTips":["Treat the entrypoint contract as exactly one default-exported function taking Alpine","Add a unit/type test asserting typeof entry.default === 'function'","Check the browser console in dev right after configuring the entrypoint option"],"tags":["alpinejs","integration","entrypoint","default-export","esm"],"backgroundTag":"missing-default-export","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}